Paste Relative


#1

I want to write a command that will paste animation relative to an existing key value.
This works, but if you’re pasting in the middle of a bunch of animation, it will shift the stuff on the right over
it should paste without shifting. Any ideas?

float $currentFrame = `currentTime -query`;
pasteKey -time $currentFrame -option insert -connect 1 -timeOffset 0 -floatOffset 0 -valueOffset 0;

Thank you in advance.


#2

Hi

Check options of the command pasteKey:
documentation

You should use one of the values of the -option(-o) flag:

-option(-o) string 
Valid values are "insert", "replace", "replaceCompletely", "merge", "scaleInsert," "scaleReplace", "scaleMerge", "fitInsert", "fitReplace", and "fitMerge". 
The default paste option is: "insert".

I’m just guessing which one, but the command should probably look like this:

pasteKey -time $currentFrame -option replaceCompletely -connect 1 -timeOffset 0 -floatOffset 0 -valueOffset 0;

#3

The “replace” flag requires a time RANGE, so I can’t use “-time $currentFrame”.
How can I find out the time range of the data on the clipboard?

For example: I copied 3 keyframes, between frames 1 and 10.
My paste command would then be -time “1:10”… but how do I query those values?


#4

Not sure if there’s a simple solution for this.

Just to be clear, here’s what I’m trying to achieve:

  • Copy the red curve into green curve.
  • The animation should paste-connect to key A’s value (it should paste as -10, not +10).
  • It should leave key B intact (don’t shift it over).

I mocked up my desired outcome in Photoshop:

I appreciate the help.