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

Synopsis

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

Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.

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, caching, category, changedSinceFileOpen, channelBox, connectable, extension, fromPlugin, hasData, hasNullData, inUse, keyable, leaf, locked, multi, output, ramp, read, readOnly, scalar, scalarAndArray, settable, shortNames, string, unlocked, usedAsFilename, userDefined, visible, write
Long name (short name) Argument types Properties
read(r) boolean create
list only attributes which are readable
write(w) boolean create
list only attributes which are writable
scalar(s) boolean create
only list scalar numerical attributes
array(a) boolean create
only list array (not multi) attributes
scalarAndArray(sa) boolean create
only list scalar and array attributes
visible(v) boolean create
only show visible or non-hidden attributes
connectable(c) boolean create
only show connectable attributes
category(ct) string createmultiuse
only show attributes belonging to the given category. Category string can be a regular expression.
fromPlugin(fp) boolean create
only show attributes that were created by a plugin
inUse(iu) boolean 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) boolean create
only show attributes that can be keyframed
channelBox(cb) boolean create
only show non-keyable attributes that appear in the channelbox
caching(ca) boolean create
only show attributes that are cached internally
extension(ex) boolean create
list user-defined attributes for all nodes of this type (extension attributes)
multi(m) boolean create
list each currently existing element of a multi-attribute
locked(l) boolean create
list only attributes which are locked
unlocked(u) boolean create
list only attributes which are unlocked
userDefined(ud) boolean create
list user-defined (dynamic) attributes
settable(se) boolean create
list attribute which are settable
shortNames(sn) boolean 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.
readOnly(ro) boolean create
List only the attributes which are readable and not writable.
output(o) boolean create
List only the attributes which are numeric or which are compounds of numeric attributes.
hasData(hd) boolean create
list only attributes that have data (all attributes except for message attributes)
hasNullData(hnd) boolean 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.
leaf(lf) boolean create
Only list the leaf-level name of the attribute. controlPoints[44].xValue would be listed as "xValue".
changedSinceFileOpen(cfo) boolean 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.
ramp(ra) boolean create
list only attributes which are ramps
usedAsFilename(uf) boolean create
list only attributes which are designated to be treated as filenames

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.

Python examples

import maya.cmds as cmds

cmds.sphere()
cmds.listAttr( r=True, s=True )
# This will list the scalar readable attributes of the
# selected nodes.  If more than one node is selected attributes
# may be listed several times.

cmds.listAttr( s=True, r=True, w=True, c=True, st=['centerX','centerY'] )
# This will list all scalar, readable, writable, and connectable
# attributes whose names are "centerX" or "centerY".

cmds.listAttr( r=True, 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".

cmds.listAttr( 'nurbsSphere1', s=True, cfo=True )
# 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.