PDA

View Full Version : copying keyframe values to next/previous keyframe


stickyblue
12-04-2003, 10:29 AM
hi i was trying to write a tiny script to help when animating but i couldnt do it , if anyone can help me explain how can i use mel to take one node's values on a keyframe and copy it to the next or previous keyframe ?

i know i can do it buy middle mouse drag the key on time slider and set key :)

thanks in advance

dwalden74
12-05-2003, 08:33 AM
Most of this can be done directly with the "keyframe" command. Have you looked at this command and tried it?

Jhavna
12-05-2003, 09:29 AM
The commands you seek are:

cutKey

or

copyKey

followed by a well placed

pasteKey

enjoy.

stickyblue
12-06-2003, 10:28 AM
sorry guys but ive been trying to do it but i couldnt figure out :-/

whats the flag that i need to use with pasteKey to make it paste to the nextKeyframe ?

thanks again

Jhavna
12-06-2003, 10:35 AM
Not sure really... but you can try using one of

to/timeOffset time How much to offset the pasted keys in time (for time-input animation curves).
-fo/floatOffset float How much to offset the pasted keys in time (for non-time-input animation curves).
-vo/valueOffset float How much to offset the pasted keys in value.

or explicitly set the key with the -time flag

have a read of the MEL reference...

stickyblue
12-06-2003, 10:37 AM
yes ive read it , but i really dont know almost anything about mel , im trying to learn it . i couldnt get it to paste to the nextkey of the attribute .

Jhavna
12-06-2003, 11:05 AM
This is how I would do it.
I assume you want to copy a key from time T to time T+1... am I right?

ok, so for the frame at time 50, copy it..

copyKey -time 50 -option keys nurbsCylinder1.translate;

the paste it...

pasteKey -time 51 -option insert nurbsCylinder1.translate;

Hope that helped...

stickyblue
12-06-2003, 11:09 AM
ah sorry this wasnt what i meant.

what i want to do is lets say i have 2 keyframes , just on translate Z

at frame 0 , translate Z = 5

at frame 20 , translate z = 60

so i want to grab any frame before frame 20 , and paste it to frame 20 which is my next key on the timeline .

like when you middle mouse drag a frame on the timeline over a keyframe or another frame and set key . it pastes the values from the frame that you middle mouse dragged .

*but i dont want to type frame 20 because i dont want to look at whats frame number of the next keyframe each time .

Jhavna
12-10-2003, 10:30 AM
Sorry, been a while, but will this do what you want?

Select a time on the timeline where the key you wish to copy is, and then run the script. It will copy that key to the next keyframe in the timeline, for ALL animcurves of the currently selected object(s).

run the script with

ss_keyToNext

let me know if that's what you were after

stickyblue
12-10-2003, 10:36 AM
ah i really appreciate it , works great!

CGTalk Moderation
01-16-2006, 09:00 PM
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.