PDA

View Full Version : animationRange set to last key


mustan9
03-20-2009, 06:20 PM
Hi,

How can I set the animationRange so that is includes all keys? I want the last frame of the range to be the last animated key.

Thanks

PiXeL_MoNKeY
03-20-2009, 06:36 PM
You would have to get all keys for all animated tracks then figure out which is the last one of importance. Then simply assign that value as the end of your animation range. Look up keys, MaxKey, and "Indexed Access to Animatable Properties in 3ds Max Objects" in the Maxscript help for more info.

-Eric

mustan9
03-20-2009, 09:06 PM
Thanks pixel, that was what I needed to know.

This function will return the time of the last keyed frame.


function lastFrameKeyed objs last_frame =
(
for i in 1 to objs.numSubs do
(
if(objs[i].keys != undefined) do
(
k = objs[i].keys
if(k.count > 0) do
(
t = k[k.count].time
if(t > last_frame) do
last_frame = t
)
)
if(objs[i].numSubs > 0) then
(
last_frame = lastFrameKeyed objs[i] last_frame
)
)

return last_frame
)


You call it like this.


last_frame = 1
for obj in objects do
(
last_frame = lastFrameKeyed obj last_frame
)
animationRange = interval 0 last_frame

CGTalk Moderation
03-20-2009, 09:06 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.