Notifications
Clear all

[Closed] Take keys from biped to model

Hello!
I have done model which consist from rigid parts and is linked to biped. For every part i need to create keys of position ant rotation. After deleting biped i need to have only model’s parts with animation keys through every N frames (for example 0, 5, 10, … 100 frame). Please help me to write script that will do this or give needed tools if they are present in max.

5 Replies

Try Blur’s animated align script over at www.scriptspot.com You’ll have to unlink the bones, but that should do the trick.

I wrote this for you just for the heck of it. Select the objects that are linked to your biped hit the save animation button. Then unlink them then load the animation file. The spinner will sample the animation based on what you tell it.

RyanT
Pipeworks Software
Foundation 9

 
rollout save_rollout "Save Animation"

(

fn saveAnim =

(

if selection.count != 0 do

(

fname = getsavefilename caption:"Select file to export" types:"ANM File (*.anm)|*.anm|All Files (*.*)|*.*|"



if fname != undefined do

(

theFile = createfile fname 

startT = animationrange.start

EndT = animationrange.end



samples = (animationrange.end as integer/ticksperframe)/save_rollout.Nframes.value

sampleRate = save_rollout.Nframes.value

frame = 0

for x = 1 to samples do 

(

at time frame

(

for obj in selection do

(

format "%
" frame to:theFile

format "%
" obj.name to:theFile

format "%
" obj.transform to:theFile

)

)

frame = frame + sampleRate

)

close theFile

)

)

)



fn loadAnim =

(

fname = getopenfilename caption:"Select file to import" types:"ANM File (*.anm)|*.anm|All Files (*.*)|*.*|"

if fname != undefined do

(

f = openfile fname

while not eof f do

(

frame = (execute (readline f))

at time frame

(

animate on

(

theNode = (getNodebyName (readline f))

theNode.transform = (execute (readline f))

)

)

)

)

)



button saveBtn "Save File" width:150 height:20

button loadBtn "Load File" width:150 height:20

spinner Nframes "N Frames" width:100 range:[1,100,1] type:#integer align:#center





on saveBtn pressed do (saveAnim())



on loadBtn pressed do (loadAnim())

)

createDialog save_rollout width:180 height:80


Thank you, guys! Very much appreciated.
Erilaz, I have tried bake script from scriptspot.com, it works well. I will also find blur’s script.
RyanT, it’s very interesting to use your script, unfortunately i have error. I open your script, and do Evaluate All, and have error at this line

) <- here i have error

button saveBtn “Save File” width:150 height:20
button loadBtn “Load File” width:150 height:20

spinner Nframes “N Frames” width:100 range:[1,100,1] type:#integer align:#center

I’m sorry, if it’s just my stupidity, i have never written any maxscripts.

Well it looks like when I pasted the code, it got messed up. Glad you got something that works. Here is a working version of mine:

  


rollout save_rollout"Save Animation"

(



fn saveAnim =



(



if selection.count != 0 do



(



fname = getsavefilename caption:"Select file to export" types:"ANM File (*.anm)|*.anm|All Files (*.*)|*.*|"



if fname != undefined do



(



theFile = createfile fname 



startT = animationrange.start



EndT = animationrange.end







samples = (animationrange.end as integer/ticksperframe)/save_rollout.Nframes.value



sampleRate = save_rollout.Nframes.value



frame = 0



for x = 1 to samples do 



(



at time frame



(



for obj in selection do



(



format "%
" frame to:theFile



format "%
" obj.name to:theFile



format "%
" obj.transform to:theFile



)



)



frame = frame + sampleRate



)



close theFile



)



)



)







fn loadAnim = 

(

fname = getopenfilename caption:"Select file to import" types:"ANM File (*.anm)|*.anm|All Files (*.*)|*.*|"

if fname != undefined do 

(

f = openfile fname



while not eof f do

(

frame = (execute (readline f))



at time frame 

(

animate on

(

theNode = (getNodebyName (readline f))

theNode.transform = (execute (readline f))

)



)

)

)

)









button saveBtn "Save File" width:150 height:20

button loadBtn "Load File" width:150 height:20

spinner Nframes "N Frames" width:100 range:[1,100,1] type:#integer align:#center



on saveBtn pressed do (saveAnim())

on loadBtn pressed do[size=2] (loadAnim())

)

createDialog save_rollout width:180 height:80

 

[/size]

RyanT, it works very well! It’s very helpful, thank you