Go to: Synopsis. Return value. Related. Flags. Python examples.
copyKey(
[objects]
, [animLayer=string], [animation=string], [attribute=string], [clipboard=string], [controlPoints=boolean], [float=floatrange], [forceIndependentEulerAngles=boolean], [hierarchy=string], [includeUpperBound=boolean], [index=uint], [option=string], [shape=boolean], [time=timerange])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
copyKey is undoable, NOT queryable, and NOT editable.
This command operates on a keyset. A keyset is defined as a group of keys within a specified time range on one or more animation curves.The animation curves comprising a keyset depend on the value of the "-animation" flag:
Note that the "-animation" flag can be used to override the curves uniquely identified by the multi-use "-attribute" flag, which takes an argument of the form attributeName, such as "translateX".
Keys on animation curves are identified by either their time values or their indices. Times and indices can be given individually or as part of a list or range.
This command copies curve segments's hierarchies from specified targets and puts them in the clipboard. Source curves are unchanged. The pasteKey command applies these curves to other objects.
The shape of the copied curve placed in the clipboard depends on the copyKey "-option" specified. Each of these options below will be explained using an example. For all the explanations, let us assume that the source animation curve (from which keys will be copied) has 5 keyframes at times 10, 15, 20, 25, and 30.
TbaseKeySetCmd.h
int | Number of animation curves copied. |
Long name (short name) | Argument types | Properties | ||
---|---|---|---|---|
animLayer(al)
|
string
|
![]() |
||
|
||||
animation(an)
|
string
|
![]() |
||
|
||||
attribute(at)
|
string
|
![]() ![]() |
||
|
||||
clipboard(cb)
|
string
|
![]() |
||
|
||||
controlPoints(cp)
|
boolean
|
![]() |
||
|
||||
float(f)
|
floatrange
|
![]() ![]() |
||
|
||||
forceIndependentEulerAngles(fea)
|
boolean
|
![]() |
||
|
||||
hierarchy(hi)
|
string
|
![]() |
||
|
||||
includeUpperBound(iub)
|
boolean
|
![]() |
||
|
||||
index(index)
|
uint
|
![]() ![]() |
||
|
||||
option(o)
|
string
|
![]() |
||
|
||||
shape(s)
|
boolean
|
![]() |
||
|
||||
time(t)
|
timerange
|
![]() ![]() |
||
|
![]() |
![]() |
![]() |
![]() |
import maya.cmds as cmds # Copy keyframes from frame 10 to 20 of cube1's "Translate X" attribute # cmds.copyKey( 'cube1', time=(10,20), attribute='translateX', option="curve" ) # Copy from all active objects all keys in the range 0 to 60 # cmds.copyKey( time=(0,60) )