Feedback

What's your question?

By: Asked from India

How do I query the end time of an animCurve in maya?

I have an animated sphere. Keyframes are between 0 to 10. What command can I use to get the end time of animation? (the 10 value)

Add comment viewed 178 times Latest activity 10 months ago

or Cancel

1 answer

  • 0

julian [ Admin ]

Use the keyframe command to get the number of keys and to query the time and value of the last key. Here's the mel:

int $numKeys = `keyframe -query -keyframeCount pSphere1.translateX`;
float $t[] = `keyframe -index  ($numKeys -1) -q -tc pSphere1.translateX`;
float $v[] = `keyframe -index  ($numKeys -1) -q -vc pSphere1.translateX`;
print ("Last key: Time="+$t[0] +", Value="+ $v[0]+"\n" );

Note, the query flag must come after the index flag.

Hope it helps

or Cancel