copying keyframe values to next/previous keyframe

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  12 December 2003
copying keyframe values to next/previous keyframe

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
  12 December 2003
Most of this can be done directly with the "keyframe" command. Have you looked at this command and tried it?
David Walden
Rigging | MEL Scripting | Animation
  12 December 2003
The commands you seek are:




followed by a well placed



  12 December 2003
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
  12 December 2003
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...

  12 December 2003
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 .
  12 December 2003
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...

  12 December 2003
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 .

Last edited by stickyblue : 12 December 2003 at 11:12 AM.
  12 December 2003
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


let me know if that's what you were after
Attached Files
File Type: zip (634 Bytes, 20 views)

  01 January 2006
Thread automatically closed

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 11:52 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.