pymel.core.animation.pasteKey

pasteKey(*args, **kwargs)

The pasteKey command pastes curve segment hierarchies from the clipboard onto other objects or curves. If the object hierarchy from which the curve segments were copied or cut does not match the object hierarchy being pasted to, pasteKey will paste as much as it can match in the hierarchy. If animation from only one object is on the clipboard, it will be pasted to each of the target objects. If animation from more than one object is on the clipboard, selection list order determines what animation is pasted to which object. Valid operations include: One attribute to one or more attributes (Clipboard animation is pasted onto all target attributes.One attribute to one or more objects (Clipboard animation pasted onto target object, when attribute names match.)Many attributes to one or more objectsClipboard animation pasted onto targets when attribute names match.TbaseKeySetCmd.h The way the keyset clipboard will be pasted to the specified object’s attributes depends on the paste -optionspecified. Each of these options below will be explained using an example. For all the explanations, let us assume that there is a curve segment with 20 frames of animation on the keyset clipboard (you can put curve segments onto the clipboard using the cutKeyor copyKeycommands). We will call the animation curve that we are pasting to the target curve: pasteKey -time 5 -option insert1. Shift all keyframes on the target curve after time 5 to the right by 20 frames (to make room for the 20-frame clipboard segment). 2. Paste the 20-frame clipboard segment starting at time 5. pasteKey -time 5:25-option replace1. Remove all keys on the target curve from 5 to 25. 2. Paste the 20-frame clipboard curve at time 5. pasteKey -option replaceCompletely1. Remove all keys on the target curve. 2. Paste the 20-frame clipboard curve, preserving the clipboard curve’s original keyframe times. pasteKey -time 5 -option merge1.The clipboard curve segment will be pasted starting at time 5 for its full 20-frame range until frame 25. 2. If a keyframe on the target curve has the same time as a keyframe on the clipboard curve, it is overwritten. Otherwise, any keys that existed in the 5:25 range before the paste, will remain untouched pasteKey -time 3:10-option scaleInsert1. Shift all keyframes on the target curve after time 3 to the right by 7 frames (to clear the range 3:10 to paste in) 2. The clipboard curve segment will be scaled to fit the specified time range (i.e. the 20 frames on the clipboard will be scaled to fit into 7 frames), and then pasted into the range 3:10. pasteKey -time 3:10-option scaleReplace1. Any existing keyframes in the target curve in the range 3:10 are removed. 2. The clipboard curve segment will be scaled to fit the specified time range (i.e. the 20 frames on the clipboard will be scaled to fit into 7 frames), and then pasted into the range 3:10. pasteKey -time 3:10-option scaleMerge1. The clipboard curve segment will be scaled to fit the specified time range (i.e. the 20 frames on the clipboard will be scaled to fit into 7 frames). 2. If there are keys on the target curve at the same time as keys on the clipboard curve, they are overwritten. Otherwise, keyframes on the target curve that existed in the 3:10 range before the paste, will remain untouched. pasteKey -time 3:10-option fitInsert1. Shift all the keyframes on the target curve after time 3 to the right by 7 frames (to clear the range 3:10 to paste in) 2. The first 7 frames of the clipboard curve segment will be pasted into the range 3:10. pasteKey -time 3:10-option fitReplace1. Any existing frames in the target curve in the range 3:10 are removed. 2. The first 7 frames of the clipboard curve segment will be pasted into the range 3:10. pasteKey -time 3:10-option fitMerge1. The first 7 frames of the clipboard curve segment will be pasted into the range 3:10. 2. If there are keys on the target curve at the same time as keys on the clipboard curve, they are overwritten. Otherwise, keyframes on the target curve that existed in the 3:10 range before the paste, will remain untouched.

Flags:
  • animation : an (unicode) [create]

    Where this command should get the animation to act on. Valid values are objects,keys,and keysOrObjectsDefault: keysOrObjects.(See Description for details.) Flag can have multiple arguments, passed either as a tuple or a list.

  • attribute : at (unicode) [create]

    List of attributes to select

  • clipboard : cb (unicode) [create]

    Specifies the clipboard from which animation is pasted. Valid clipboards are apiand anim. The default clipboard is: anim

  • connect : c (bool) [create]

    When true, connect the source curve with the destination curve’s value at the paste time. (This has the effect of shifting the clipboard curve in value to connect with the destination curve.) False preserves the source curve’s original keyframe values. Default is false.

  • copies : cp (int) [create]

    The number of times to paste the source curve.

  • float : f (floatRange) [create]

    value uniquely representing a non-time-based key (or key range) on a time-based animCurve. Valid floatRange include single values (-f 10) or a string with a lower and upper bound, separated by a colon (-f 10:20

  • floatOffset : fo (float) [create]

    How much to offset the pasted keys in time (for non-time-input animation curves).

  • includeUpperBound : iub (bool) [create]

    When the -t/time or -f/float flags represent a range of keys, this flag determines whether the keys at the upper bound of the range are included in the keyset. Default value: true. This flag is only valid when the argument to the -t/time flag is a time range with a lower and upper bound. (When used with the pasteKeycommand, this flag refers only to the time range of the target curve that is replaced, when using options such as replace,fitReplace,or scaleReplace.This flag has no effect on the curve pasted from the clipboard.)

  • index : index (indexRange) [create]

    index of a key on an animCurve

  • option : o (unicode) [create]

    Valid values are insert, replace, replaceCompletely, merge, scaleInsert,scaleReplace, scaleMerge, fitInsert, fitReplace, and fitMerge. The default paste option is: insert.

  • time : t (timeRange) [create]

    time uniquely representing a key (or key range) on a time-based animCurve. Valid timeRanges include single values (-t 10) or a string with a lower and upper bound, separated by a colon (-t 10:20

  • timeOffset : to (time) [create]

    How much to offset the pasted keys in time (for time-input animation curves).

  • valueOffset : vo (float) [create]

    How much to offset the pasted keys in value.

Derived from mel command maya.cmds.pasteKey

Previous topic

pymel.core.animation.parentConstraint

Next topic

pymel.core.animation.pathAnimation

Core

Core Modules

Other Modules

This Page