pymel.core.animation.clipSchedule

clipSchedule(*args, **kwargs)

This command is used to create, edit and query clips and blends in the Trax editor. It operates on the clipScheduler node attached to the character. In query mode, if no flags are specified, returns an array of strings in this form: (clipName,clipIndex,clipStart,clipSourceStart,clipSourceEnd,clipScale,clipPreCycle,clipPostCycle,clipHold)

Flags:
Long name (short name) Argument Types Properties
absolute (abs) bool ../../../_images/query.gif ../../../_images/edit.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.

absoluteRotations (abr) bool ../../../_images/query.gif ../../../_images/edit.gif
 

This flag is now deprecated. Use aa/allAbsolute, ar/allRelative, ra/rotationsAbsolute, or da/defaultAbsolute instead. If true, this overrides the abs/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.

allAbsolute (aa) bool ../../../_images/edit.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.

allRelative (ar) bool ../../../_images/edit.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.

blend (b) int, int ../../../_images/create.gif ../../../_images/query.gif
 
This flag is used to blend two clips, whose indices are provided as flag arguments.
blendNode (bn) int, int ../../../_images/query.gif
 

This query only flag list all of the blend nodes associated with the blend defined by the two clip indices. This flag returns a string array. In query mode, this flag can accept a value.

blendUsingNode (bun) unicode ../../../_images/create.gif
 

This flag is used if you want to blend using an existing blend node. It is used in conjunction with the blend flag. The blend flag specifies the clip indices for the blend. The name of an existing animBlend node should be supplied supplied as an argument for the blendUsingNode flag.

character (ch) bool ../../../_images/query.gif
 
This flag is used to query which characters this scheduler controls. It returns an array of strings.
clipIndex (ci) int ../../../_images/create.gif ../../../_images/query.gif
 

Specify the index of the clip to schedule. In query mode, returns an array of strings in this form: (clipName,index,start,sourceStart,sourceEnd,scale,preCycle,postCycle) In query mode, this flag can accept a value.

cycle (c) float ../../../_images/create.gif ../../../_images/query.gif
 
This flag is now obsolete. Use the postCycle flag instead.
defaultAbsolute (da) bool ../../../_images/edit.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.

enable (en) bool ../../../_images/create.gif ../../../_images/query.gif
 
This flag is used to enable or disable a clip. It must be used in conjunction with the ci/clipIndex flag. The specified clip will be enabled or disabled.
group (grp) bool ../../../_images/create.gif
 
This flag is used to add (true) or remove (false) a list of clips (specified with groupIndex) into a group.
groupIndex (gri) int ../../../_images/create.gif
 

This flag specifies a multiple number of clips to be added or removed from a group.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list.

groupName (gn) unicode ../../../_images/create.gif ../../../_images/query.gif
 

This flag is used to specify the group that should be added to. If no group by that name exists and new group is created with that name. By default if this is not specified a new group will be created.

hold (ph) time ../../../_images/create.gif ../../../_images/query.gif
 
Specify how long to hold the last value of the clip after its normal or cycled end.
insertTrack (it) int ../../../_images/create.gif
 
This flag is used to insert a new empty track at the track index specified.
instance (instance) unicode ../../../_images/create.gif
 

Create an instanced copy of the named clip. An instanced clip is one that is linked to an original clip. Thus, changes to the animation curve of the original curve will also modify all instanced clips. The name of the instanced clip is returned as a string.

listCurves (lc) bool ../../../_images/create.gif ../../../_images/query.gif
 

This flag is used to list the animation curves associated with a clip. It should be used in conjunction with the clipIndex flag, which specifies the clip of interest.

listPairs (lp) bool ../../../_images/query.gif
 

This query only flag returns a string array containing the channels in a character that are used by a clip and the names of the animation curves that drive the channels. Each string in the string array consists of the name of a channel, a space, and the name of the animation curve animating that channel. This flag must be used with the ci/clipIndex flag.

lock (l) bool ../../../_images/query.gif ../../../_images/edit.gif
 
This flag specifies whether clips on a track are to be locked or not. Must be used in conjuction with the track flag.
mute (m) bool ../../../_images/query.gif ../../../_images/edit.gif
 
This flag specifies whether clips on a track are to be muted or not. Must be used in conjuction with the track flag.
name (n) unicode ../../../_images/create.gif ../../../_images/query.gif
 

This flag is used to query the name of the clip node associated with the specified clip index, or to specify the name of the instanced clip during instancing. In query mode, this flag can accept a value.

postCycle (poc) float ../../../_images/create.gif ../../../_images/query.gif
 
Specify the number of times to repeat the clip after its normal end.
preCycle (prc) float ../../../_images/create.gif ../../../_images/query.gif
 
Specify the number of times to repeat the clip before its normal start.
remove (rm) bool ../../../_images/create.gif
 

This flag is used to remove a clip from the timeline. It must be used in conjunction with the ci/clipIndex flag. The specified clip will be removed from the timeline, but will still exist in the library and any instanced clips will remain in the timeline. To permanently remove a clip from the scene, the clip command should be used instead.

removeBlend (rb) int, int ../../../_images/create.gif
 
This flag is used to remove an existing blend between two clips, whose indices are provided as flag arguments.
removeEmptyTracks (ret) bool ../../../_images/create.gif
 
This flag is used to remove all tracks that have no clips.
removeTrack (rt) int ../../../_images/create.gif
 
This flag is used to remove the track with the specified index. The track must have no clips on it before it can be removed.
rotationsAbsolute (ra) bool ../../../_images/edit.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.

scale (sc) float ../../../_images/create.gif ../../../_images/query.gif
 
Specify the amount to scale the clip. Values must be greater than 0.
shift (sh) int ../../../_images/create.gif
 

This flag allows multiple clips to be shifted by a certain number of tracks and works in conjunction with the shiftIndex flag. The flag specifies the number of tracks to shift the associated clips. Positive values shift the clips down an negative values shift the clips up.

shiftIndex (shi) int ../../../_images/create.gif
 

This flag allows multiple clips to be shifted by a certain number of tracks and works in conjunction with the shiftAmount flag. The flag specifies the index of the clip to shift. This flag can be used multiple times on the command line to specify a number of clips to shift.

solo (so) bool ../../../_images/query.gif ../../../_images/edit.gif
 
This flag specifies whether clips on a track are to be soloed or not. Must be used in conjuction with the track flag.
sourceClipName (scn) bool ../../../_images/create.gif ../../../_images/query.gif
 
This flag is used to query the name of the source clip node associated with the specified clip index.
sourceEnd (se) time ../../../_images/create.gif ../../../_images/query.gif
 
Specify where to end in the source clip’s animation curves
sourceStart (ss) time ../../../_images/create.gif ../../../_images/query.gif
 
Specify where to start in the source clip’s animation curves
start (s) time ../../../_images/create.gif ../../../_images/query.gif
 
Specify the placement of the start of the clip
track (t) int ../../../_images/create.gif ../../../_images/query.gif
 

Specify the track to operate on. For example, which track to place a clip on, which track to mute/lock/solo. In query mode, it may be used in conjuction with the clipIndex flag to return the track number of a clip, where track 1 is the first track of the character. In query mode, this flag can accept a value.

weight (w) float ../../../_images/create.gif ../../../_images/query.gif
 
This flag is used in to set or query the weight of the clip associated with the specified clip index.
weightStyle (ws) int ../../../_images/create.gif ../../../_images/query.gif
 
This flag is used to set or query the weightStyle attribute of the clip associated with the specified clip index.

Derived from mel command maya.cmds.clipSchedule

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' )
# Query the name of the clipScheduler for this character
#
pm.character( 'arm', query=True, sc=True )
# Result: armScheduler1
# Create a 2nd animation for the character.
#
pm.select( 'joint2', r=True )
pm.currentTime( 0 )
pm.setKeyframe( 'arm' )
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' )
# Instance handeWave at time 10
#
pm.clipSchedule( 'armScheduler1', instance='handWave', s=10 )
# Query the clip index of the latest instance of handWave. Each instance
# of a clip received a unique clipIndex. The clip index is used to
# edit and query data for existing clips.
#
pm.clipSchedule( 'armScheduler1', name='handWave1', query=True, ci=True )
# Query whether the clip associated with index 2 is enabled or not
#
pm.clipSchedule( 'armScheduler1', ci=2, query=True, enable=True )
# Query the name of the clip associated with index 2
#
pm.clipSchedule( 'armScheduler1', ci=2, query=True, n=True )
# Query the weight of the clip associated with index 2
#
pm.clipSchedule( 'armScheduler1', ci=2, query=True, weight=True )
# Modify the elbowWave clip to start at frame 10 instead of frame 0
#
pm.clipSchedule( 'armScheduler1', start=10, ci=1 )
# Trim the start of the elbowWave clip to
# use the animation starting at frame 5 instead 0
#
pm.clipSchedule( 'armScheduler1', sourceStart=5, ci=1 )
# Trim the end of the elbowWave clip to
# use the animation up to frame 15 instead 20
#
pm.clipSchedule( 'armScheduler1', sourceEnd=15, ci=1 )
# Modify the handWave clip to have two cycles instead of 1
#
pm.clipSchedule( 'armScheduler1', postCycle=1, ci=0 )
# list the animation curves associated with a particular clip
#
pm.clipSchedule( 'armScheduler1', ci=2, listCurves=True )
# Move a particular clip to a particular track
#
pm.clipSchedule( 'armScheduler1', track=2, ci=0 )
# Add a blend between clips 1 and 2
#
pm.clipSchedule( 'armScheduler1', b=(1, 2) )
# Query the name of the blendNode between clips 1 and 2
#
pm.clipSchedule( 'armScheduler1', q=True, bn=(1, 2) )
# Lock the first track and then query its state
#
pm.clipSchedule( 'armScheduler1', track=1, e=True, lock=1 )
pm.clipSchedule( 'armScheduler1', track=1, query=True, lock=True )
# Query the existing clips in the scheduler.
# In query mode, returns an array of strings in this form:
# (clipName,index,start,sourceStart,sourceEnd,scale,preCycle,postCycle,hold)
#
# In this case there are three scheduled clips:
#  2 instances of "handWave" and 1 of "elbowWave". The clip indices for "handWave" are 0
#  and 3. The clip index for "elbowWave" is 2. Note that the clip indices can be sparse
#  since a clip maintains its index as long as it is in the schedule (the TraX editor).
#
pm.clipSchedule( 'armScheduler1', query=True )
# Result: handWave,0,0.000000,0.000000,20.000000,1.000000,0.00000,2.00000 elbowWave,1,0.000000,5.000000,15.000000,1.000000,0.00000,1.00000 handWave,2,10.000000,0.000000,20.000000,1.000000,0.00000,1.00000
#
# Shift clips 1 and 2 up 3 tracks
#
pm.clipSchedule( 'armScheduler1', sh=-3, shi=1, shi=2 )
# Print out which anim curves animate which channels for the
# clip with an index of 2.
#
out = pm.clipSchedule('armScheduler1' ,ci=2, query=True, lp=True)
for pair in out:
   print pair

Previous topic

pymel.core.animation.clipMatching

Next topic

pymel.core.animation.clipSchedulerOutliner

Core

Core Modules

Other Modules

This Page