pymel.core.animation.play

play(*args, **kwargs)

This command starts and stops playback. In order to change the frame range of playback, see the playbackOptions command. In query mode, return type is based on queried flag.

Flags:

Long Name / Short Name Argument Types Properties
forward / f bool ../../../_images/create.gif ../../../_images/query.gif
  When true, play back the animation from the currentTime to the maximum of the playback range. When false, play back from the currentTime to the minimum of the playback range. When queried, returns an int.
playSound / ps bool ../../../_images/create.gif ../../../_images/query.gif
  Specify whether or not sound should be used during playback
record / rec bool ../../../_images/create.gif ../../../_images/query.gif
  enable the recording system and start one playback loop
sound / s unicode ../../../_images/create.gif ../../../_images/query.gif
  Specify the sound node to be used during playback
state / st bool ../../../_images/create.gif ../../../_images/query.gif
  start or stop playing back
wait / w bool ../../../_images/create.gif
  Wait till completion before returning control to command Window. Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.play

Example:

import pymel.core as pm

# Begin playback from min to max
#
pm.play( forward=True )

# Begin playback from max to min
#
pm.play( forward=False )

# Stop (forward or backward) playback
#
pm.play( state=False )

# Record mode through one playback loop
#
pm.play( record=True )

# Are we playing back?  Returns 1 if yes, 0 if no.
#
pm.play( q=True, state=True )
# Result: True #