Attributes of DG Nodes in Maya

How to see the attributes belonging to a node:

  • The channel box shows the current selection's "keyable" attributes.
  • Open the attribute editor window, of course, but this doesnt show the attributes as a list or how they might appear in a MEL script.
  • In the Outliner window, use the Display menu to show attributes
  • Use "Window>General Editors>Channel Control..." to open a window showing all "keyable" attributes of a node as well as all the "non-keyable" attributes (and they can be made keyable using this window).
  • Use "Window>General Editors>Attribute Spreadsheet"
  • Run the MEL command "listAttr" on the selected node to return a full or filtered list of attributes belonging to it.
  • Last but not least, use "Help>Node and Attribute Reference" for full descriptions of attributes for each node.

How to access attributes in MEL scripts:

Attributes are appended to the node name:


This is how you would query the x translation of the object to get its current value:

getAttr nurbsSphere1.translateX

Or to set it to a new value:

setAttr nurbsSphere1.translateX 5

You can also establish connections between nodes in MEL (or break connections):

connectAttr -f nurbsSphere1.rotateY nurbsSphere2.rotateY

disconnectAttr -f nurbsSphere1.rotateY nurbsSphere2.rotateY

How to access attributes in Expressions:
Accessing attributes in expressions is done differently.
Using the setAttr and getAttr commands in expressions should be avoided whenever possible.

Setting an attribute in an expression:

nurbsSphere.translateX = 5;

Getting an attribute:

$variable = nurbsSphere.translateX;

or variations like:

polyCube.translateY = nurbsSphere.translateX;