PDA

View Full Version : Take keys from biped to model


shserge
09-26-2005, 09:54 AM
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.

erilaz
09-26-2005, 11:54 PM
Try Blur's animated align script over at www.scriptspot.com You'll have to unlink the bones, but that should do the trick.

RyanT
09-27-2005, 12:19 AM
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 "%\n" frame to:theFile

format "%\n" obj.name to:theFile

format "%\n" 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

shserge
09-27-2005, 08:15 AM
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.

RyanT
09-27-2005, 06:04 PM
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 "%\n" frame to:theFile



format "%\n" obj.name to:theFile



format "%\n" 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

shserge
09-28-2005, 07:19 AM
RyanT, it works very well! It's very helpful, thank you :)

CGTalk Moderation
09-28-2005, 07:19 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.