pymel.core.animation.clip

clip(*args, **kwargs)

This command is used to create, edit and query character clips.

Flags:
Long name (short name) Argument Types Properties
absolute (abs) bool ../../../_images/create.gif
 

This flag is now deprecated. Use aa/allAbsolute, ar/allRelative, ra/rotationsAbsolute, or da/defaultAbsolute instead. This flag controls whether the clip follows its keyframe values or whether they are offset by a value to maintain a smooth path. Default is true.

absoluteRotations (abr) bool ../../../_images/create.gif
 

This flag is now deprecated. Use aa/allAbsolute, ar/allRelative, ra/rotationsAbsolute, or da/defaultAbsolute instead. If true, this overrides the -absolute flag so that rotation channels are always calculated with absolute offsets. This allows you to have absolute offsets on rotations and relative offsets on all other channels.

active (a) unicode ../../../_images/query.gif ../../../_images/edit.gif
 

Query or edit the active clip. This flag is not valid in create mode. Making a clip active causes its animCurves to be hooked directly to the character attributes in addition to being attached to the clip library node. This makes it easier to access the animCurves if you want to edit, delete or add additional animCruves to the clip.

addTrack (at) bool  
 
This flag is now obsolete. Use the insertTrack flag on the clipSchedule command instead.
allAbsolute (aa) bool ../../../_images/create.gif
 

Set all channels to be calculated with absolute offsets. This flag cannot be used in conjunction with the ar/allRelative, ra/rotationsAbsolute or da/defaultAbsolute flags.

allClips (ac) bool ../../../_images/query.gif
 
This flag is used to query all the clips in the scene. Nodes of type “animClip” that are storing poses, are not returned by this command.
allRelative (ar) bool ../../../_images/create.gif
 

Set all channels to be calculated with relative offsets. This flag cannot be used in conjunction with the aa/allAbsolute, ra/rotationsAbsolute or da/defaultAbsolute flags.

allSourceClips (asc) bool ../../../_images/query.gif
 
This flag is used to query all the source clips in the scene. Nodes of type “animClip” that are storing poses or clip instances, are not returned by this command.
animCurveRange (acr) bool ../../../_images/create.gif
 

This flag can be used at the time you create the clip instead of the startTime and endTime flags. It specifies that you want the range of the clip to span the range of keys in the clips associated animCurves.

character (ch) bool ../../../_images/query.gif
 
This is a query only flag which operates on the specified clip. It returns the names of any characters that a clip is associated with.
constraint (cn) bool ../../../_images/create.gif
 

This creates a clip out of any constraints on the character. The constraint will be moved off of the character and into the clip, so that it is only active for the duration of the clip, and its value can be scaled/offset/cycled according to the clip attributes.

copy (c) bool ../../../_images/create.gif ../../../_images/query.gif
 

This flag is used to copy a clip or clips to the clipboard. It should be used in conjunction with the name flag to copy the named clips on the specified character and its subcharacters. In query mode, this flag allows you to query what, if anything, has been copied into the clip clipboard.

defaultAbsolute (da) bool ../../../_images/create.gif
 

Sets all top-level channels except rotations in the clip to relative, and the remaining channels to absolute. This is the default during clip creation if no offset flag is specified. This flag cannot be used in conjunction with the aa/allAbsolute, ar/allRelative, or ra/rotationsAbsolute flags.

duplicate (d) bool ../../../_images/query.gif
 
Duplicate the clip specified by the name flag. The start time of the new clip should be specified with the startTime flag.
endTime (end) time ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 
Specify the clip end
expression (ex) bool ../../../_images/create.gif
 

This creates a clip out of any expressions on the character. The expression will be moved off of the character and into the clip, so that it is only active for the duration of the clip, and its value can be scaled/offset/cycled according to the clip attributes.

ignoreSubcharacters (ignoreSubcharacters) bool ../../../_images/create.gif
 

During clip creation, duplication and isolation, subcharacters are included by default. If you want to create a clip on the top level character only, or you want to duplicate the clip on the top level character without including subCharacters, use the ignoreSubcharacters flag.

isolate (i) bool ../../../_images/create.gif
 

This flag should be used in conjunction with the name flag to specify that a clip or clips should be copied to a new clip library. The most common use of this flag is for export, when you want to only export certain clips from the character, without exporting all of the clips.

leaveOriginal (lo) bool ../../../_images/create.gif
 
This flag is used when creating a clip to specify that the animation curves should be copied to the clip library, and left on the character.
mapMethod (mm) unicode ../../../_images/create.gif
 

This is is valid with the paste and pasteInstance flags only. It specifies how the mapping should be done. Valid options are: “byNodeName”, “byAttrName”, “byCharacterMap”, “byAttrOrder”, “byMapOrAttrName” and “byMapOrNodeName”. “byAttrName” is the default. The flags mean the following: “byAttrOrder” maps using the order that the character stores the attributes internally, “byAttrName” uses the attribute name to find a correspondence, “byNodeName” uses the node name *and* the attribute name to find a correspondence, “byCharacterMap” uses the existing characterMap node to do the mapping. “byMapOrAttrName” uses a character map if one exists, otherwise uses the attribute name. “byMapOrNodeName” uses a character map if one exists, otherwise uses the attribute name.

name (n) unicode ../../../_images/create.gif ../../../_images/query.gif
 

In create mode, specify the clip name. In query mode, return a list of all the clips. In duplicate mode, specify the clip to be duplicated. In copy mode, specify the clip to be copied. This flag is multi-use, but multiple use is only supported with the copy flag. For use during create and with all other flags, only the first instance of the name flag will be utilized. In query mode, this flag can accept a value.

newName (nn) unicode ../../../_images/create.gif
 
Rename a clip. Must be used in conjunction with the clip name flag, which is used to specify the clip to be renamed.
paste (p) bool ../../../_images/create.gif
 
This flag is used to paste a clip or clips from the clipboard to a character. Clips are added to the clipboard using the c/copy flag.
pasteInstance (pi) bool ../../../_images/create.gif
 

This flag is used to paste an instance of a clip or clips from the clipboard to a character. Unlike the p/paste flag, which duplicates the animCurves from the original source clip, the pi/pasteInstance flag shares the animCurves from the source clip.

remove (rm) bool ../../../_images/query.gif
 
Remove the clip specified by the name flag. The clip will be permanently removed from the library and deleted from any times where it has been scheduled.
removeTrack (rt) bool ../../../_images/create.gif
 
This flag is now obsolete. Use removeTrack flag on the clipSchedule command instead.
rotationOffset (rof) float, float, float ../../../_images/create.gif ../../../_images/query.gif
 

Return the channel offsets used to modify the clip’s rotation.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list.

rotationsAbsolute (ra) bool ../../../_images/create.gif
 

Set all channels except rotations to be calculated with relative offsets. Rotation channels will be calculated with absolute offsets. This flag cannot be used in conjunction with the aa/allAbsolute, ar/allRelative or da/defaultAbsolute flags.

scheduleClip (sc) bool ../../../_images/create.gif
 

This flag is used when creating a clip to specify whether or not the clip should immediately be scheduled at the current time. If the clip is not scheduled, the clip will be placed in the library for future use, but will not be placed on the timeline. This flag is for use only when creating a new clip or duplicating an existing. The default is true.

sourceClipName (scn) bool ../../../_images/query.gif
 
This flag is for query only. It returns the name of the source clip that controls an instanced clip.
split (sp) time ../../../_images/create.gif ../../../_images/edit.gif
 
Split an existing clip into two clips. The split occurs around the specified time.
startTime (s) time ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 
Specify the clip start
translationOffset (tof) float, float, float ../../../_images/create.gif ../../../_images/query.gif
 
Return the channel offsets used to modify the clip’s translation.
useChannel (uc) unicode ../../../_images/create.gif
 

Specify which channels should be acted on. This flag is valid only in conjunction with clip creation, and the isolate flag. The specified channels must be members of the character.

Derived from mel command maya.cmds.clip

Example:

import pymel.core as pm

import maya.cmds as cmds

# First, create a character to hold the clips. The character will be
# a 3-bone skeleton named "arm".
#
pm.select( d=True )
pm.joint( p=(0, 0, 0) )
# Result: nt.Joint(u'joint1') #
pm.joint( p=(0, 4, 0)  )
# Result: nt.Joint(u'joint2') #
pm.joint( 'joint1', e=True, zso=True, oj='xyz' )
pm.joint( p=(0, 8, -1) )
# Result: nt.Joint(u'joint3') #
pm.joint( 'joint2', e=True, zso=True, oj='xyz' )
pm.joint( p=(0, 9, -2) )
# Result: nt.Joint(u'joint4') #
pm.joint( 'joint3', e=True, zso=True, oj='xyz' )
pm.select( 'joint1', 'joint2', 'joint3', r=True )
pm.character( name='arm' )
# Result: nt.Character(u'arm') #
# Create some animation for the character. For this example the animation will
# be quite trivial.
#
pm.select( 'joint3', r=True )
pm.currentTime( 0 )
# Result: 0.0 #
pm.setKeyframe( 'joint3.rx' )
# Result: 1 #
pm.currentTime( 10 )
# Result: 10.0 #
pm.setKeyframe( 'joint3.rx', v=90 )
# Result: 1 #
pm.currentTime( 20 )
# Result: 20.0 #
pm.setKeyframe( 'joint3.rx', v=0 )
# Result: 1 #
# Create a clip for the current animation named "handWave"
#
pm.clip( 'arm', startTime=0, endTime=20, name='handWave' )
# Create a 2nd animation for the character.
#
pm.select( 'joint2', r=True )
pm.currentTime( 0 )
pm.setKeyframe( 'joint2.rx' )
pm.setKeyframe( 'joint2.ry', v=20 )
pm.currentTime( 10 )
pm.setKeyframe( 'joint2.rx', v=45 )
pm.setKeyframe( 'joint2.ry', v=-20 )
pm.currentTime( 20 )
pm.setKeyframe( 'joint2.rx', v=0 )
pm.setKeyframe( 'joint2.ry', v=20 )
# Create a clip for the current animation named "elbowWave"
#
pm.clip( 'arm', startTime=0, endTime=20, name='elbowWave' )
# Query the existing source clips
#
pm.clip( 'arm', query=True, n=True )
[u'handWaveSource', u'elbowWaveSource']
# Query the active clip. Note that the default clip is always active unless
# another clip has been specified as active. This means that new keyframes
# always go into the default clip unless you make another clip active.
#
pm.clip( 'arm', query=True, active=True )
default
# Duplicate the clip named "elbowWaveSource" on the character named "arm" and
# place the duplicate in the schedule at a start time of 50
#
pm.clip( 'arm', duplicate=True, name='elbowWaveSource', s=50 )
# Duplicate the clip named "wiggle" on the character named "arm" and
# do not place the duplicate in the schedule
#
pm.clip( 'arm', duplicate=True, sc=False, name='wiggle' )
# Remove the clip from the character altogether. All instances of the clip will be
# removed from the schedule and deleted from the library.
#
pm.clip( 'arm', rm=True, name='elbowWaveSource')
# Make the handWave clip active. This means that any new keyframes get
# placed in the handWave clip, and modifications to existing handWave
# keyframes can be made.
#
pm.clip( 'arm', edit=True, active='handWave' )
# Split the clip named "handWave" into two clips at time 10
#
pm.clip( 'arm', split=10, name='handWave' )
# Query the startTime of a clip. This is the start frame of the animation
# curve range of the clip, and may differ from the scheduled time of the clip,
# which is accessed using the clipSchedule command.
#
pm.clip( 'arm', name='handWave', query=True, s=True )

Previous topic

pymel.core.animation.choice

Next topic

pymel.core.animation.clipEditor

Core

Core Modules

Other Modules

This Page