Script that exports the vertices of a model at each animation frame

Script that exports the vertices of a model at each animation frame

rpardridge
Participant Participant
369 Views
2 Replies
Message 1 of 3

Script that exports the vertices of a model at each animation frame

rpardridge
Participant
Participant

I want a script that simply exports the selected mesh as a collada file called 1.dae, then advances one frame, exports the mesh as 2.dae, then another frame, 3.dae, etc

 

Any help appreciated, thanks!

0 Likes
370 Views
2 Replies
Replies (2)
Message 2 of 3

inquestudios
Enthusiast
Enthusiast

Go through your timeline with for ... do cycle,
make a snapshotAsMesh() of your model,
make a new editable_mesh() and assign your snapshot to it,
select your new mesh,
export selected to <frameNumber>.dae,

delete new mesh.

0 Likes
Message 3 of 3

MartinBeh
Advisor
Advisor

Is Collada still a thing?

 

Try this:

with undo off (
-- create some test geometry, this needs to be replaced by you
s = sphere name:"sphere"
-- theObj should contain the object you want to export
theObj = $sphere
for t = animationRange.start to animationRange.end do (
    -- move the time slider, to make sure everything in the scene is updated
    sliderTime = t
    -- create a temp copy of the object
    local m = snapshot theObj
    select m
    -- export as frame_0000.dae, frame_0001.dae etc.
    exportFile (@"c:\tmp\frame_" + (formattedPrint (currentTime.frame as integer) format:"04d") + ".dae") #noPrompt selectedOnly:true using:DaeExporter
    -- clean up
    delete m
)
)

 

Martin B   EESignature
→ please 'Like' posts that are helpful; if a post answers your question please click the "Accept Solution" button.
0 Likes