Go to: Synopsis. Flags. Return value. Related. Python examples.
deleteAttr(
<nodes | attrs>
, [attribute=string], [query=boolean])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
deleteAttr is undoable, queryable, and editable.
This command is used to delete a dynamic attribute
from a node or nodes. The attribute can be specified
by using either the long or short name. Only one
dynamic attribute can be deleted at a time. Static
attributes cannot be deleted. Children of a compound
attribute cannot be deleted. You must delete the
complete compound attribute. This command has no
edit capabilities. The only query ability is to list
all the dynamic attributes of a node.
attribute, query
Long name (short name) |
[argument types] |
Properties |
attribute(at)
|
string
|
|
|
Specify either the long or short name of the attribute.
|
|
query(q)
|
boolean
|
|
|
List all dynamic attributes of a node.
Only one node may be specified.
In query mode, this flag needs a value.
|
|
Flag can appear in Create mode of command
|
Flag can appear in Edit mode of command
|
Flag can appear in Query mode of command
|
Flag can have multiple arguments, passed either as a tuple or a list.
|
none
addAttr, aliasAttr, attributeInfo, getClassification, nodeType, objExists, objectType, renameAttr
import maya.cmds as cmds
cmds.createNode( 'planet', n='mars' )
cmds.addAttr( ln='martians', sn='mr', at='double' )
cmds.addAttr( ln='greenMen', sn='gm', at='double' )
# Delete an attribute named mr/martians.
cmds.deleteAttr( 'mars', at='mr' )
# Alternative syntax
cmds.deleteAttr( 'mars.greenMen' )
# Query for the list of dynamic attributes.
cmds.deleteAttr( 'mars', q=True )