Go to: Synopsis. Return value. Related. Flags. MEL examples.

Synopsis

listAttr [-array] [-attributeType string] [-caching] [-category string] [-changedSinceFileOpen] [-channelBox] [-connectable] [-extension] [-fromPlugin] [-fullNodeName boolean] [-hasData] [-hasNullData] [-inUse] [-keyable] [-leaf] [-locked] [-multi] [-nodeName boolean] [-output] [-ramp] [-read] [-readOnly] [-scalar] [-scalarAndArray] [-settable] [-shortNames] [-string string] [-unlocked] [-usedAsFilename] [-userDefined] [-visible] [-write] [objects]

listAttr is undoable, NOT queryable, and NOT editable.

This command lists the attributes of a node. If no flags are specified all attributes are listed.

Return value

string[]: List of attributes matching criteria

Related

addAttr, attributeInfo, attributeQuery, connectAttr, disconnectAttr, getAttr, setAttr

Flags

array, attributeType, caching, category, changedSinceFileOpen, channelBox, connectable, extension, fromPlugin, fullNodeName, hasData, hasNullData, inUse, keyable, leaf, locked, multi, nodeName, output, ramp, read, readOnly, scalar, scalarAndArray, settable, shortNames, string, unlocked, usedAsFilename, userDefined, visible, write
Long name (short name) Argument types Properties
-array(-a) create
only list array (not multi) attributes
-attributeType(-at)
2023.1
string createmultiuse
Return attributes of a particular type.
-caching(-ca) create
only show attributes that are cached internally
-category(-ct) string createmultiuse
only show attributes belonging to the given category. Category string can be a regular expression.
-changedSinceFileOpen(-cfo) create
Only list the attributes that have been changed since the file they came from was opened. Typically useful only for objects/attributes coming from referenced files.
-channelBox(-cb) create
only show non-keyable attributes that appear in the channelbox
-connectable(-c) create
only show connectable attributes
-extension(-ex) create
list user-defined attributes for all nodes of this type (extension attributes)
-fromPlugin(-fp) create
only show attributes that were created by a plugin
-fullNodeName(-fnn)
2023.1
boolean create
Return full node name in result.
-hasData(-hd) create
list only attributes that have data (all attributes except for message attributes)
-hasNullData(-hnd) create
list only attributes that have null data. This will list all attributes that have data (see hasData flag) but the data value is uninitialized. A common example where an attribute may have null data is when a string attribute is created but not yet assigned an initial value. Similarly array attribute data is often null until it is initialized.
-inUse(-iu) create
only show attributes that are currently marked as in use. This flag indicates that an attribute affects the scene data in some way. For example it has a non-default value or it is connected to another attribute. This is the general concept though the precise implementation is subject to change.
-keyable(-k) create
only show attributes that can be keyframed
-leaf(-lf) create
Only list the leaf-level name of the attribute. controlPoints[44].xValue would be listed as "xValue".
-locked(-l) create
list only attributes which are locked
-multi(-m) create
list each currently existing element of a multi-attribute
-nodeName(-nn)
2023.1
boolean create
Return node name in result.
-output(-o) create
List only the attributes which are numeric or which are compounds of numeric attributes.
-ramp(-ra) create
list only attributes which are ramps
-read(-r) create
list only attributes which are readable
-readOnly(-ro) create
List only the attributes which are readable and not writable.
-scalar(-s) create
only list scalar numerical attributes
-scalarAndArray(-sa) create
only list scalar and array attributes
-settable(-se) create
list attribute which are settable
-shortNames(-sn) create
list short attribute names (default is to list long names)
-string(-st) string createmultiuse
List only the attributes that match the other criteria AND match the string(s) passed from this flag. String can be a regular expression.
-unlocked(-u) create
list only attributes which are unlocked
-usedAsFilename(-uf) create
list only attributes which are designated to be treated as filenames
-userDefined(-ud) create
list user-defined (dynamic) attributes
-visible(-v) create
only show visible or non-hidden attributes
-write(-w) create
list only attributes which are writable

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 be used more than once in a command.

MEL examples

listAttr -r -s;
     // This will list the scalar readable attributes of the
     // selected nodes.  If more than one node is selected attributes
     // may be listed several times.

listAttr -s -r -w -c -st centerX -st centerY;
     // This will list all scalar, readable, writable, and connectable
     // attributes whose names are "centerX" or "centerY".

listAttr -r -st "center*" -ct "a*";
     // This will list all readable attributes whose names match
	 // "center*" (e.g. "centerX" or "centerpede") and who belong to
	 // a category starting with the letter "a".

listAttr -s -cfo nurbsSphere1;
     // This will list all scalar attributes of
     // nurbsSphere1 that have been changed since the
     // file in which nurbsSphere1 is defined has been
     // opened.  If nurbsSphere1 comes from a referenced file,
     // the result will be all the attributes that have changed
       // since the referenced file was opened.