Maya Animation Layers
From wikinotes
Concept
Item-Attributes are added to renderlayers. They can be additive (default), or averages. Active AnimLayers are layers that are going to be receiving keys. It is possible for multiple layers to be active at the same time (depending your current item selection). Items/Item-Attributes must be added to a layer in order for them to be used.
Programming
# Layer Editor Queries cmds.treeView( "AnimLayerTabanimLayerEditor", q=True, item=True ) # list selected animlayers # Object-Centric Queries cmds.animLayer( q=True, affectedLayers=True ) # list all animlayers that contain at least one of the selected items cmds.animLayer( q=True, bestAnimLayer=True ) # list all of the 'active' animlayers for the current selection # (all animlayers that will be receiving keyframes) cmds.animLayer( 'pCube1.translateX', q=True, bestLayer=True ) # list the single animlayer that will be receiving # a keyframe on 'pCube1' attribute 'translateX'
Graph Editor
By default, curves from all animation layers are displayed in the graph editor. You can modify this behaviour by performing the following:
## Right click in outliner section of graph-editor (left)
Animation Layer Filters > Active
MotionTrail (Animation Curve) to Nurbs Curve
// Select the motionTrail Handle (Animation Curve) (or it's control points)
// that you want to convert to a curve
{
string $selected[];
string $obj;
string $curve;
float $size;
float $pts[];
$selected=`ls -dag -exactType snapshotShape`;
for ($obj in $selected){
$pts=(`getAttr($obj+".pts")`);
$size=size($pts);
$curve=`curve -d 1 -p $pts[0] $pts[1] $pts[2] -p $pts[4] $pts[5] $pts[6] -k 0 -k 1`;
for($i=8;$i<$size;$i+=4)
curve -os -a -p $pts[$i] $pts[$i+1] $pts[$i+2] $curve ;
}
}