Animation Curves within Maya are 1D Hermite curves controlling
a single floating point value over time. Any animated attribute
will recieve an in-coming connection from an animation curve
node.
Example 1 : Querying Animation curves
attached to a node
To query for an animated attribute, we need to get a list of
all in-coming connections to the node and find out if they are
animation curves.
// this function takes the name of a node and prints
// the names of all animated attributesproclistAttachedAnimCurves(string $node) {
// get the connections and connected nodes
$src_a = `listConnections -s true -d false -c true $node`;
$src_n = `listConnections -s true -d false $node`;
print($node+"\n");
for($i=0;$i<size($src_n);$i++) {
$j = $i*2;
// query the node type of the connected node
$type = `nodeType $src_n[$i]`;
// see if it's a
// time to angular curve
// time to length curve or a
// time to unitless curveif($type=="animCurveTA" ||
$type=="animCurveTL" ||
$type=="animCurveTU") {
print("\t"+$src_a[$j+1]+"\n");
}
}
}
Example 2 : Accessing Key Frames on a
Curve
As previously mentioned, Maya's animation curves are based
on hermite curves (see the devkit/animEngine example for
a complete curve implimentation). Hermite curves are parametric
curves which use tangents at their control points. Each control
point will also contain an input and an output tangent. It is
these tangents and points that are used to evaluate the curve.
// this function takes the name of a node and prints
// the names of all animated attributesproclistAttachedAnimCurves(string $node) {
// get the connections and connected nodes
$src_a = `listConnections -s true -d false -c true $node`;
$src_n = `listConnections -s true -d false $node`;
print($node+"\n");
for($i=0;$i<size($src_n);$i++) {
$j = $i*2;
// query the node type of the connected node
$type = `nodeType $src_n[$i]`;
// see if it's a
// time to angular curve
// time to length curve or a
// time to unitless curveif($type=="animCurveTA" ||
$type=="animCurveTL" ||
$type=="animCurveTU") {
print("\t"+$src_a[$j+1]+"\n");
}
}
}