class MAnimControl

Jump to documentation

Control over animation playback and values (OpenMayaAnim) (OpenMayaAnim.py)

public members:

enum PlaybackMode
kPlaybackOnce
Play the animation once then stop
kPlaybackLoop
Play the animation continuously
kPlaybackOscillate
Play the animation forwards, then backwards continuously
enum PlaybackViewMode
kPlaybackViewAll
The animation plays back in all views
kPlaybackViewActive
The animation plays back in only the active view
MAnimControl ()
virtual ~MAnimControl ()
static MAnimControl::PlaybackMode playbackMode ()
static MStatus setPlaybackMode ( PlaybackMode newMode )
static MAnimControl::PlaybackViewMode viewMode ()
static MStatus setViewMode ( PlaybackViewMode newMode )
static double playbackBy ()
static MStatus setPlaybackBy ( const double& newTime )
static MTime minTime ()
static MTime maxTime ()
static MStatus setMinTime ( MTime newMinTime )
static MStatus setMaxTime ( MTime newMaxTime )
static MStatus setMinMaxTime ( MTime min, MTime max )
static MTime animationStartTime ()
static MTime animationEndTime ()
static MStatus setAnimationStartTime ( MTime newStartTime )
static MStatus setAnimationEndTime ( MTime newEndTime )
static MStatus setAnimationStartEndTime ( MTime newStartTime, MTime newEndTime )
static MTime currentTime ()
static MStatus setCurrentTime ( const MTime & newTime )
static double playbackSpeed ()
static MStatus setPlaybackSpeed ( double newSpeed )
static MStatus playForward ()
static MStatus playBackward ()
static bool isPlaying ()
static MStatus stop ()
static bool autoKeyMode ()
static MStatus setAutoKeyMode ( bool mode )
static MFnAnimCurve::TangentType globalInTangentType ( MStatus * ReturnStatus = NULL )
static MStatus setGlobalInTangentType (const MFnAnimCurve::TangentType &tangentType )
static MFnAnimCurve::TangentType globalOutTangentType ( MStatus * ReturnStatus = NULL )
static MStatus setGlobalOutTangentType (const MFnAnimCurve::TangentType &tangentType )
static bool weightedTangents ( MStatus * ReturnStatus = NULL )
static MStatus setWeightedTangents ( bool weightState )

Documentation

Retrieve and set animation parameters and control playback
Description

This class provide access to the values that control how an animation is played. This includes the minimum and maximum frames included in the playback, whether the playback loops, and whether the animation runs in all views, or only the active view, etc.

Methods also exist that mirror the functionality of the controls found on the time slider in the UI to start and stop the playback.

Functions

MAnimControl:: MAnimControl ()

Description

Class constructor.

MAnimControl:: ~MAnimControl ()

Description

Class destructor

MAnimControl::PlaybackMode MAnimControl:: playbackMode ()

Description

Return the playback mode currently in effect.

Return Value

  • an element of the MAnimControl::PlaybackMode enum.

MStatus MAnimControl:: setPlaybackMode ( PlaybackMode newMode)

Description

Set the current playback mode.

Arguments

  • newMode an element of MAnimControl::PlaybackMode

Return Value

  • MS::kSuccess mode was changed successfully
  • MS::kFailure the mode was not changed

MAnimControl::PlaybackViewMode MAnimControl:: viewMode ()

Description

Return the viewing mode currently in effect.

Return Value

  • an element of the MAnimControl::PlaybackViewMode enum.

MStatus MAnimControl:: setViewMode ( PlaybackViewMode newMode )

Description

Set the current viewing mode. Controls whether the animation is run in only the active view, or simultaneously in all views.

Arguments

  • newMode an element of MAnimControl::PlaybackViewMode

Return Value

  • MS::kSuccess mode was changed successfully
  • MS::kFailure the mode was not changed

double MAnimControl:: playbackBy ()

Description

Return a double specifying the increment between times viewed during the playing of the animation.

Return Value

  • a double containing the increment

MStatus MAnimControl:: setPlaybackBy ( const double& newTime )

Description

Specify the increment between times viewed during the playing of the animation.

Arguments

  • newTime a double containing the new increment

Return Value

  • MS::kSuccess the increment was changed successfully
  • MS::kFailure the increment was not changed

MTime MAnimControl:: minTime ()

Description

Return an MTime specifying the first frame of the current playback time range. This corresponds to the minTime which can also be set and queried using the playbackOptions mel command. It does not represent the first frame of the total animation time unless the two coincide.

Return Value

  • an MTime instance specifying the first frame of the playback time range

MTime MAnimControl:: maxTime ()

Description

Return an MTime specifying the last frame of the current playback time range. This corresponds to the maxTime which can also be set and queried using the playbackOptions mel command. It does not represent the final frame of the total animation time unless the two coincide.

Return Value

  • an MTime instance specifying the last frame of the playback time range

MStatus MAnimControl:: setMinTime ( MTime newMinTime)

Description

Set the first frame of the current playback time range.

Arguments

  • newMinTime an MTime containing the frame

Return Value

  • MS::kSuccess the minTime was changed successfully
  • MS::kFailure the minTime was not changed.

MStatus MAnimControl:: setMaxTime ( MTime newMaxTime)

Description

Set the value of the last frame of the current playback time range.

Arguments

  • newMinTime an MTime containing the new frame

Return Value

  • MS::kSuccess the maxTime was changed successfully
  • MS::kFailure the maxTime was not changed.

MStatus MAnimControl:: setMinMaxTime ( MTime min, MTime max)

Description

Set the values of the first and last frames of the playback time range.

Arguments

  • min an MTime containing the new first frame
  • max an MTime containing the new last frame

Return Value

  • MS::kSuccess the first and last frames were changed successfully
  • MS::kFailure neither the first or last frames were changed

MTime MAnimControl:: animationStartTime ()

Description

Return an MTime specifying the first frame of the animation, as specified by the Maya user in the Range Slider UI. This corresponds to the animationStartTime which can also be set and queried using the playbackOptions mel command.

Return Value

  • an MTime instance specifying the first frame of the animation

MTime MAnimControl:: animationEndTime ()

Description

Return an MTime specifying the last frame of the animation, as specified by the Maya user in the Range Slider UI. This corresponds to the animationEndTime which can also be set and queried using the playbackOptions mel command.

Return Value

  • an MTime instance specifying the last frame in the animation

MStatus MAnimControl:: setAnimationStartTime ( MTime newStartTime)

Description

Set the value of the first frame in the animation.

Arguments

  • newStartTime an MTime containing the new first frame

Return Value

  • MS::kSuccess the first frame was changed successfully
  • MS::kFailure the first frame was not changed.

MStatus MAnimControl:: setAnimationEndTime ( MTime newEndTime)

Description

Set the value of the last frame in the animation.

Arguments

  • newEndTime an MTime containing the new last frame

Return Value

  • MS::kSuccess the last frame was changed successfully
  • MS::kFailure the last frame was not changed.

MStatus MAnimControl:: setAnimationStartEndTime ( MTime newStartTime, MTime newEndTime)

Description

Set the values of the first and last frames in the animation.

Arguments

  • newStartTime an MTime containing the new first frame
  • newEndTime an MTime containing the new last frame

Return Value

  • MS::kSuccess the first and last frames were changed successfully
  • MS::kFailure neither the first or last frames were changed

MTime MAnimControl:: currentTime ()

Description

Return an MTime instance containing the current animation frame.

Return Value

  • an MTime containing the current animation frame

MStatus MAnimControl:: setCurrentTime ( const MTime & newTime )

Description

Set the current animation frame.

Arguments

  • newTime an MTime containing the new animation frame

Return Value

  • MS::kSuccess the current frame was set successfully successfully
  • MS::kFailure the current frame was not changed.

double MAnimControl:: playbackSpeed ()

Description

Return the speed with with to play the animation.

Return Value

  • the desired playback speed factor

MStatus MAnimControl:: setPlaybackSpeed ( double newSpeed )

Description

Set the desired speed factor at which the animation will play back.

Arguments

  • newSpeed the new speed factor

Return Value

  • MS::kSuccess the new speed was set successfully
  • MS::kFailure the new speed was not set changed

MStatus MAnimControl:: playForward ()

Description

Start playing the current animation forwards.

Return Value

  • MS::kSuccess the animation started successfully
  • MS::kFailure the animation did not start

MStatus MAnimControl:: playBackward ()

Description

Start playing the current animation backwards.

Return Value

  • MS::kSuccess the animation started successfully
  • MS::kFailure the animation did not start

bool MAnimControl:: isPlaying ()
Description

Return a value indicating whether Maya is currently playing the animation.

Return Value

  • true the animation is currently playing
  • false the animation is not currently playing

MStatus MAnimControl:: stop ()

Description

Stop playing the current animation.

Return Value

  • MS::kSuccess the animation stopped successfully
  • MS::kFailure the animation did not stop

bool MAnimControl:: autoKeyMode ()

Description

Return the autoKeyMode.

Return Value

  • true the autoKeyMode is on
  • false the autoKeyMode is off

MStatus MAnimControl:: setAutoKeyMode ( bool mode )

Description

Set the autoKeyMode.

Arguments

  • mode a boolean specifying the new mode

Return Value

  • MS::kSuccess the autoKeyMode was set successfully
  • MS::kFailure the autoKeyMode was not changed

MFnAnimCurve::TangentType MAnimControl:: globalInTangentType ( MStatus * ReturnStatus )

Description

Return the current global in tangent type.

Arguments

  • ReturnStatus Status Code (see below)

Return Value

  • MFnAnimCurve::TangentType the current global in tangent type

Status Codes

  • MS::kSuccess Success
  • MS::kFailure Could not find globalInTangent preference

MStatus MAnimControl:: setGlobalInTangentType ( const MFnAnimCurve::TangentType &tangentType )

Description

Set the current global in tangent type.

Arguments

  • tangentType the global in tangent type to set [Note: MFnAnimCurve::kTangentGlobal and MFnAnimCurve::kTangentFixed are not valid arguments]

Return Value

  • MS::kSuccess the current global in tangent type was set successfully
  • MS::kFailure the current global in tangent type was not changed

MFnAnimCurve::TangentType MAnimControl:: globalOutTangentType ( MStatus * ReturnStatus)

Description

Return the current global out tangent type.

Arguments

  • ReturnStatus Status Code (see below)

Return Value

  • MFnAnimCurve::TangentType the current global out tangent type

Status Codes

  • MS::kSuccess Success
  • MS::kFailure Could not find globalOuttangent preference

MStatus MAnimControl:: setGlobalOutTangentType ( const MFnAnimCurve::TangentType &tangentType )

Description

Set the current global out tangent type.

Arguments

  • MFnAnimCurve::TangentType the global out tangent type to set [Note: MFnAnimCurve::kTangentGlobal and MFnAnimCurve::kTangentFixed are not valid arguments]

Return Value

  • MS::kSuccess the current global out tangent type was set successfully
  • MS::kFailure the current global out tangent type was not changed

bool MAnimControl:: weightedTangents ( MStatus * ReturnStatus )

Description

Determine whether or not the tangents on the Anim Curve are weighted.

Arguments

  • ReturnStatus Status Code

Return Value

  • true the tangents on the Anim Curve are weighted
  • false the tangents on the Anim Curve are not weighted

Status Codes

  • MS::kSuccess Success
  • MS::kFailure When the method fails

MStatus MAnimControl:: setWeightedTangents ( bool weightState )

Description

Sets whether or not the tangents on the Anim Curve are weighted. Note: switching a curve from weightedTangents true to false and back to true again will not preserve fixed tangents properly. Use undo instead.

Arguments

  • weightState a boolean specifying whether tangents should be weighted or not

Return Value

  • MS::kSuccess the tangent weight state was set successfully
  • MS::kFailure the tangent weight state was not changed

This class has no child classes.


Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. doc++ Copyright