Announcements

Between mid-October and November, the content on AREA will be relocated to the Autodesk Community M&E Hub and the Autodesk Community Gallery. Learn more HERE.

Is there a script that saves an animated scene in as many files as frames exist in the animation?

Is there a script that saves an animated scene in as many files as frames exist in the animation?

victor_enrich
Enthusiast Enthusiast
569 Views
5 Replies
Message 1 of 6

Is there a script that saves an animated scene in as many files as frames exist in the animation?

victor_enrich
Enthusiast
Enthusiast

Hi everyone.

I have a simple scene with an animated camera and a plane that has a "lookat" constraint towards the camera. The camera is animated over 101 frames (0-100) with a simple trajectory.

I would like to know whether there's a script that will take this scene and create 101  .max scenes, each of which including the 2 objects, non animated, and in their respective position and rotation displaying in each specific frame. If If the scene is called "scene.max", the generated files should be named scene_000.max, scene_001.max up to scene_100.max.

That's all.

Thanks so much

Cheers.

0 Likes
570 Views
5 Replies
Replies (5)
Message 2 of 6

dmitriy.shpilevoy
Collaborator
Collaborator

Every frame part is simple enough

for i=animationRange.start to animationRange.end do (
	<stuff saving code>
	format "saving frame %\n" i
)

 

0 Likes
Message 3 of 6

victor_enrich
Enthusiast
Enthusiast

 

Thanks for your answer, Dimitry.

How do I implement this code?

What am I supposed to add in the "stuff saving code" area?

Thanks again.

0 Likes
Message 4 of 6

dmitriy.shpilevoy
Collaborator
Collaborator

You can run it in listener ( Scripting / Maxscript Listener).
Paste code there replacing whatever might be there at the moment, select all and Shift + Enter

or save to text file and change extension to .ms then just drag-n-drop in viewport
Remove the whole line with <> - it will give you errors otherwise.

 

In Listener you can enable Macrorecorder which shows maxscript code for whatever you are doing(well, not all of it  alas, but a huge chunck that can get you started)

Try going from there. Export single frame by hand as you want script to do it and see if macrorecorder gives you something meaningful. I doubt it would be as easy as replacing <stuff saving code> with it, but should get you started.

0 Likes
Message 5 of 6

istan
Advisor
Advisor

He did not talk about, but as he wants to save separate .max files, he probably also needs to remove all animation controllers from those files..

0 Likes
Message 6 of 6

victor_enrich
Enthusiast
Enthusiast

Perhaps an easier way is to make one hundred copies of the animated objects and give each of them the position of every frame. For instance: cameracopy_002 position from frame 002, cameracopy_003 position from frame 003, up to frame 100.

0 Likes