
This symbol is used by Maya to indicate hierarchical relationships between nodes in order to provide fully qualified node and attribute names.

If you were to print out the contents of the animAttributes array, you would likely see something like the following: |bouncingBall.rotateXĪlthough the bouncingBall.rotateX part likely makes sense, you may be wondering about the | symbol. This will give us a list of all the attributes on the selected object that can be animated, including any custom attributes that have been added to it. To get the list of keyframeable attributes, we use the listAnimateable command: objs = cmds.ls(selection=True)ĪnimAttributes = cmds.listAnimatable(obj) Once we’ve done that, we’ll iterate over all the keyframeable attributes, determine if they have any keyframes and, if they do, run through the times and values. We start out by grabbing the selected object, as usual. ('Found ', 20, ' keyframes on ', u'|anslateY') ('Found ', 2, ' keyframes on ', u'|anslateX') We would see something like the following output in the script editor:. For example, if we had a simple bouncing ball animation with the following curves: If you select an object with animation curves and run the script, you should see a readout of the time and value for each keyframe on each animated attribute. Index=(0,numKeyframes), valueChange=True) Values = cmds.keyframe(attribute, query=True,


Times = cmds.keyframe(attribute, query=True, Print("Found ", numKeyframes, " keyframes on ", NumKeyframes = cmds.keyframe(attribute, query=True, How to do it…Ĭreate a new file and add the following code: import maya.cmds as cmdsĪnimAttributes = cmds.listAnimatable(obj) Either load up a scene with animation or skip ahead to the recipe on setting keyframes. To make get the most out of this script, you’ll need to have an object with some animation curves defined.
