Notifications
Clear all

[Closed] Fetching Scene animationRange

Is there a way to fetch a max scene’s animationRange, such that after using, say, a mergemaxfile to bring in a scene, I can set the current scene’s animation range to that of the imported scene? Thanks.

5 Replies
1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

there is no way to get animation range of the scene without opening the file. I wrote a script which saves animation range and some other data on #filePreSaveProcess event into file’s attributes. If you put it into startup holder you will be able to read this data without opening the file. In max 2010 it’s easy now. Just use Asset Metadata (see MAX File Asset Metadata Stream Access)

reset max and change the variables filename1 and filename2 to the files you want to merge

filename1 = "D:\file1.max"
 filename2 = "D:\file2.max"
 loadmaxfile filename1
 start1 = animationRange.start
 end1 = animationRange.end
 loadmaxfile filename2
 start2 = animationRange.start
 end2 = animationRange.end
 start = if (start1 < start2) then (start1) else (start2)
 end = if (end1 > end2) then end1 else end2
 mergemaxfile filename1 #renameMtlDups 
 animationRange = interval ((start as integer) / ticksperframe) ((end as integer) / ticksperframe)
 

cheers!

Thanks Horn, I was afraid I might have to open the file itself to grab it. Sucks for huge, slow-loading files but it works!

Just a note that the Render Range is stored in the file properties (whatever is set in the Render Dialog – the Single Frame, Active Range or User Range) so it would be possible to get that from the MAX file without opening it. If you render range generally matches the scene segment, it might be an option…

Sounds a bit complicated, Bobo, but it would be a big help. Any ideas where to start with that? I’m not too familiar with retrieving properties from max files.