Message 1 of 3
Set frame range to include all frames with animation on selected objects?

Not applicable
06-23-2008
10:49 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Relative newbie here in Maxscript and would appreciate any help.
What I want to do is set frame range to include all frames with animation on selected objects.
This is ultimately so I can Export Selected to .FBX a specific set of objects, baking the keys to include any animation - in a batch. The current frame ranges are often only a small section of the full animation, but I want to export all the animated frames.
I'm sure there is an easier (or more complex, but quicker) way of doing this, but here is what I have so far:
--make my selection
--(I don't have a problem scripting this, obviously will vary depending on the project)
--setting the range to be large enough to include all animation in most of my files
animationRange = interval 0f 10000f
--setting the current frame to 10000
sliderTime = 10000f
--toggling on the Key Mode Toggle
--then going to Previous Key
sliderTime -= 1 --according to the listener, this command is the same whether the Key Mode Toggle is on or off
--then setting the EndFrame to the Current Frame
animationRange = interval 0f sliderTime
--btw setting the StartFrame to frame 0 trusts that no segments start before zero, which might not always be true
--that would capture all animation from 0 to highest numbered keyed frame
Problems:
How do I toggle the Key Mode Toggle via maxscript?
The listener is wrong, even with the Key Mode Toggle on, 'sliderTime -= 1' just goes back one frame, not to the Previous Key. How do I do that?
What I want to do is set frame range to include all frames with animation on selected objects.
This is ultimately so I can Export Selected to .FBX a specific set of objects, baking the keys to include any animation - in a batch. The current frame ranges are often only a small section of the full animation, but I want to export all the animated frames.
I'm sure there is an easier (or more complex, but quicker) way of doing this, but here is what I have so far:
--make my selection
--(I don't have a problem scripting this, obviously will vary depending on the project)
--setting the range to be large enough to include all animation in most of my files
animationRange = interval 0f 10000f
--setting the current frame to 10000
sliderTime = 10000f
--toggling on the Key Mode Toggle
--then going to Previous Key
sliderTime -= 1 --according to the listener, this command is the same whether the Key Mode Toggle is on or off
--then setting the EndFrame to the Current Frame
animationRange = interval 0f sliderTime
--btw setting the StartFrame to frame 0 trusts that no segments start before zero, which might not always be true
--that would capture all animation from 0 to highest numbered keyed frame
Problems:
How do I toggle the Key Mode Toggle via maxscript?
The listener is wrong, even with the Key Mode Toggle on, 'sliderTime -= 1' just goes back one frame, not to the Previous Key. How do I do that?