pymel.core.general.listAttr

listAttr(*args, **kwargs)

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

Modifications:
  • returns an empty list when the result is None
Flags:
Long name (short name) Argument Types Properties
array (a) bool ../../../_images/create.gif
 
only list array (not multi) attributes
caching (ca) bool ../../../_images/create.gif
 
only show attributes that are cached internally
category (ct) unicode ../../../_images/create.gif
 
only show attributes belonging to the given category. Category string can be a regular expression.
changedSinceFileOpen (cfo) bool ../../../_images/create.gif
 

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) bool ../../../_images/create.gif
 
only show non-keyable attributes that appear in the channelbox
connectable (c) bool ../../../_images/create.gif
 
only show connectable attributes
extension (ex) bool ../../../_images/create.gif
 
list user-defined attributes for all nodes of this type (extension attributes)
fromPlugin (fp) bool ../../../_images/create.gif
 
only show attributes that were created by a plugin
hasData (hd) bool ../../../_images/create.gif
 
list only attributes that have data (all attributes except for message attributes)
hasNullData (hnd) bool ../../../_images/create.gif
 

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) bool ../../../_images/create.gif
 

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) bool ../../../_images/create.gif
 
only show attributes that can be keyframed
leaf (lf) bool ../../../_images/create.gif
 
Only list the leaf-level name of the attribute. controlPoints[44].xValue would be listed as “xValue”.
locked (l) bool ../../../_images/create.gif
 
list only attributes which are locked
multi (m) bool ../../../_images/create.gif
 
list each currently existing element of a multi-attribute
output (o) bool ../../../_images/create.gif
 
List only the attributes which are numeric or which are compounds of numeric attributes.
ramp (ra) bool ../../../_images/create.gif
 
list only attributes which are ramps
read (r) bool ../../../_images/create.gif
 
list only attributes which are readable
readOnly (ro) bool ../../../_images/create.gif
 
List only the attributes which are readable and not writable.
scalar (s) bool ../../../_images/create.gif
 
only list scalar numerical attributes
scalarAndArray (sa) bool ../../../_images/create.gif
 
only list scalar and array attributes
settable (se) bool ../../../_images/create.gif
 
list attribute which are settable
shortNames (sn) bool ../../../_images/create.gif
 
list short attribute names (default is to list long names)
string (st) unicode ../../../_images/create.gif
 
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) bool ../../../_images/create.gif
 
list only attributes which are unlocked
usedAsFilename (uf) bool ../../../_images/create.gif
 

list only attributes which are designated to be treated as filenamesFlag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list.

userDefined (ud) bool ../../../_images/create.gif
 
list user-defined (dynamic) attributes
visible (v) bool ../../../_images/create.gif
 
only show visible or non-hidden attributes
write (w) bool ../../../_images/create.gif
 
list only attributes which are writable

Derived from mel command maya.cmds.listAttr

Example:

import pymel.core as pm

import maya.cmds as cmds

pm.sphere()
# Result: [nt.Transform(u'nurbsSphere1'), nt.MakeNurbSphere(u'makeNurbSphere1')] #
pm.listAttr( r=True, s=True )
# Result: [u'caching', u'isHistoricallyInteresting', u'nodeState', u'isCollapsed', u'blackBox', u'isHierarchicalConnection', u'publishedNodeInfo.isHierarchicalNode', u'viewMode', u'templateVersion', u'uiTreatment', u'boundingBoxMinX', u'boundingBoxMinY', u'boundingBoxMinZ', u'boundingBoxMaxX', u'boundingBoxMaxY', u'boundingBoxMaxZ', u'boundingBoxSizeX', u'boundingBoxSizeY', u'boundingBoxSizeZ', u'boundingBoxCenterX', u'boundingBoxCenterY', u'boundingBoxCenterZ', u'visibility', u'intermediateObject', u'template', u'ghosting', u'instObjGroups.objectGroups.objectGroupId', u'instObjGroups.objectGroups.objectGrpColor', u'useObjectColor', u'objectColor', u'overrideDisplayType', u'overrideLevelOfDetail', u'overrideShading', u'overrideTexturing', u'overridePlayback', u'overrideEnabled', u'overrideVisibility', u'overrideColor', u'lodVisibility', u'identification', u'layerRenderable', u'layerOverrideColor', u'renderLayerInfo.renderLayerId', u'renderLayerInfo.renderLayerRenderable', u'renderLayerInfo.renderLayerColor', u'ghostingControl', u'ghostPreSteps', u'ghostPostSteps', u'ghostStepSize', u'ghostColorPreA', u'ghostColorPreR', u'ghostColorPreG', u'ghostColorPreB', u'ghostColorPostA', u'ghostColorPostR', u'ghostColorPostG', u'ghostColorPostB', u'ghostRangeStart', u'ghostRangeEnd', u'bess', u'les', u'wes', u'translateX', u'translateY', u'translateZ', u'rotateX', u'rotateY', u'rotateZ', u'rotateOrder', u'scaleX', u'scaleY', u'scaleZ', u'shearXY', u'shearXZ', u'shearYZ', u'rotatePivotX', u'rotatePivotY', u'rotatePivotZ', u'rotatePivotTranslateX', u'rotatePivotTranslateY', u'rotatePivotTranslateZ', u'scalePivotX', u'scalePivotY', u'scalePivotZ', u'scalePivotTranslateX', u'scalePivotTranslateY', u'scalePivotTranslateZ', u'rotateAxisX', u'rotateAxisY', u'rotateAxisZ', u'transMinusRotatePivotX', u'transMinusRotatePivotY', u'transMinusRotatePivotZ', u'minTransXLimit', u'minTransYLimit', u'minTransZLimit', u'maxTransXLimit', u'maxTransYLimit', u'maxTransZLimit', u'minTransXLimitEnable', u'minTransYLimitEnable', u'minTransZLimitEnable', u'maxTransXLimitEnable', u'maxTransYLimitEnable', u'maxTransZLimitEnable', u'minRotXLimit', u'minRotYLimit', u'minRotZLimit', u'maxRotXLimit', u'maxRotYLimit', u'maxRotZLimit', u'minRotXLimitEnable', u'minRotYLimitEnable', u'minRotZLimitEnable', u'maxRotXLimitEnable', u'maxRotYLimitEnable', u'maxRotZLimitEnable', u'minScaleXLimit', u'minScaleYLimit', u'minScaleZLimit', u'maxScaleXLimit', u'maxScaleYLimit', u'maxScaleZLimit', u'minScaleXLimitEnable', u'minScaleYLimitEnable', u'minScaleZLimitEnable', u'maxScaleXLimitEnable', u'maxScaleYLimitEnable', u'maxScaleZLimitEnable', u'selectHandleX', u'selectHandleY', u'selectHandleZ', u'inheritsTransform', u'displayHandle', u'displayScalePivot', u'displayRotatePivot', u'displayLocalAxis', u'showManipDefault', u'rotateQuaternionX', u'rotateQuaternionY', u'rotateQuaternionZ', u'rotateQuaternionW', u'rotationInterpolation', u'miDeriveFromMaya', u'miHide', u'miVisible', u'miTrace', u'miShadow', u'miCaustic', u'miGlobillum', u'miExportGeoShader', u'miProxyRenderable'] #
# This will list the scalar readable attributes of the
# selected nodes.  If more than one node is selected attributes
# may be listed several times.

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

pm.listAttr( r=True, st='center*', ct='a*' )
# Result: [] #
# 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".

pm.listAttr( 'nurbsSphere1', s=True, cfo=True )
# Result: [] #
# 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.

Previous topic

pymel.core.general.license

Next topic

pymel.core.general.listAttrPatterns

Core

Core Modules

Other Modules

This Page