- Main Page
- Related Pages
- Modules
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Member Functions | Static Public Member Functions

# MAnimControl Class Reference
OpenMayaAnim - API module for animation

Search for all occurrences

## Detailed Description

Control over animation playback and values.

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.

`#include <MAnimControl.h>`

List of all members.

## Public Types
enum | PlaybackMode { kPlaybackOnce, kPlaybackLoop, kPlaybackOscillate }
| Animation playback modes. More...
enum | PlaybackViewMode { kPlaybackViewAll, kPlaybackViewActive }
| Animation playback viewing modes. More...
## Public Member Functions
| MAnimControl ()
| Class constructor.
virtual | ~MAnimControl ()
| Class destructor.
## Static Public Member Functions
static MAnimControl::PlaybackMode | playbackMode ()
| Return the playback mode currently in effect.
static MStatus | setPlaybackMode (PlaybackMode newMode)
| Set the current playback mode.
static MAnimControl::PlaybackViewMode | viewMode ()
| Return the viewing mode currently in effect.
static MStatus | setViewMode (PlaybackViewMode newMode)
| Set the current viewing mode.
static double | playbackBy ()
| Return a double specifying the increment between times viewed during the playing of the animation.
static MStatus | setPlaybackBy (const double &newTime)
| Specify the increment between times viewed during the playing of the animation.
static MTime | minTime ()
| Return an MTime specifying the first frame of the current playback time range.
static MTime | maxTime ()
| Return an MTime specifying the last frame of the current playback time range.
static MStatus | setMinTime (MTime newMinTime)
| Set the first frame of the current playback time range.
static MStatus | setMaxTime (MTime newMaxTime)
| Set the value of the last frame of the current playback time range.
static MStatus | setMinMaxTime (MTime min, MTime max)
| Set the values of the first and last frames of the playback time range.
static MTime | animationStartTime ()
| Return an MTime specifying the first frame of the animation, as specified by the Maya user in the Range Slider UI.
static MTime | animationEndTime ()
| Return an MTime specifying the last frame of the animation, as specified by the Maya user in the Range Slider UI.
static MStatus | setAnimationStartTime (MTime newStartTime)
| Set the value of the first frame in the animation.
static MStatus | setAnimationEndTime (MTime newEndTime)
| Set the value of the last frame in the animation.
static MStatus | setAnimationStartEndTime (MTime newStartTime, MTime newEndTime)
| Set the values of the first and last frames in the animation.
static MTime | currentTime ()
| Return an MTime instance containing the current animation frame.
static MStatus | setCurrentTime (const MTime &newTime)
| Set the current animation frame.
static double | playbackSpeed ()
| Return the speed with with to play the animation.
static MStatus | setPlaybackSpeed (double newSpeed)
| Set the desired speed factor at which the animation will play back.
static MStatus | playForward ()
| Start playing the current animation forwards.
static MStatus | playBackward ()
| Start playing the current animation backwards.
static bool | isPlaying ()
| Return a value indicating whether Maya is currently playing the animation.
static MStatus | stop ()
| Stop playing the current animation.
static bool | autoKeyMode ()
| Return the autoKeyMode.
static MStatus | setAutoKeyMode (bool mode)
| Set the autoKeyMode.
static MFnAnimCurve::TangentType | globalInTangentType (MStatus *ReturnStatus=NULL)
| Return the current global in tangent type.
static MStatus | setGlobalInTangentType (const MFnAnimCurve::TangentType &tangentType)
| Set the current global in tangent type.
static MFnAnimCurve::TangentType | globalOutTangentType (MStatus *ReturnStatus=NULL)
| Return the current global out tangent type.
static MStatus | setGlobalOutTangentType (const MFnAnimCurve::TangentType &tangentType)
| Set the current global out tangent type.
static bool | weightedTangents (MStatus *ReturnStatus=NULL)
| Determine whether or not the tangents on the Anim Curve are weighted.
static MStatus | setWeightedTangents (bool weightState)
| Sets whether or not the tangents on the Anim Curve are weighted.

## Member Enumeration Documentation

enum PlaybackMode

Search for all occurrences

Animation playback modes.

Enumerator:

  kPlaybackOnce | Play once then stop. Search for all occurrences
  kPlaybackLoop | Play continuously. Search for all occurrences
  kPlaybackOscillate | Play forwards, then backwards continuously. Search for all occurrences

enum PlaybackViewMode

Search for all occurrences

Animation playback viewing modes.

Enumerator:

  kPlaybackViewAll | Playback in all views. Search for all occurrences
  kPlaybackViewActive | Playback in only the active view. Search for all occurrences

## Member Function Documentation

MAnimControl::PlaybackMode playbackMode | ( |  | ) | `[static]`

Search for all occurrences

Return the playback mode currently in effect.

Returns:
  An element of the MAnimControl::PlaybackMode enum.

MStatus setPlaybackMode | ( | PlaybackMode | newMode | ) | `[static]`

Search for all occurrences

Set the current playback mode.

Parameters:

  [in] | newMode | an element of MAnimControl::PlaybackMode

Returns:
  - MS::kSuccess mode was changed successfully
  - MS::kFailure the mode was not changed

MAnimControl::PlaybackViewMode viewMode | ( |  | ) | `[static]`

Search for all occurrences

Return the viewing mode currently in effect.

Returns:
  An element of the MAnimControl::PlaybackViewMode enum.

MStatus setViewMode | ( | PlaybackViewMode | newMode | ) | `[static]`

Search for all occurrences

Set the current viewing mode.

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

Parameters:

  [in] | newMode | an element of MAnimControl::PlaybackViewMode

Returns:
  - MS::kSuccess mode was changed successfully
  - MS::kFailure the mode was not changed

double playbackBy | ( |  | ) | `[static]`

Search for all occurrences

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

Returns:
  A double containing the increment

MStatus setPlaybackBy | ( | const double & | newTime | ) | `[static]`

Search for all occurrences

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

Parameters:

  [in] | newTime | a double containing the new increment

Returns:
  - MS::kSuccess the increment was changed successfully
  - MS::kFailure the increment was not changed

MTime minTime | ( |  | ) | `[static]`

Search for all occurrences

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.

Returns:
  An MTime instance specifying the first frame of the playback time range

Examples:
  animInfoCmd.cpp.

MTime maxTime | ( |  | ) | `[static]`

Search for all occurrences

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.

Returns:
  An MTime instance specifying the last frame of the playback time range

Examples:
  animInfoCmd.cpp.

MStatus setMinTime | ( | MTime | newMinTime | ) | `[static]`

Search for all occurrences

Set the first frame of the current playback time range.

Parameters:

  [in] | newMinTime | an MTime containing the frame

Returns:
  - MS::kSuccess the minTime was changed successfully
  - MS::kFailure the minTime was not changed.

MStatus setMaxTime | ( | MTime | newMaxTime | ) | `[static]`

Search for all occurrences

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

Parameters:

  [in] | newMaxTime | an MTime containing the new frame

Returns:
  - MS::kSuccess the maxTime was changed successfully
  - MS::kFailure the maxTime was not changed.

MStatus setMinMaxTime | ( | MTime | min,
|  | MTime | max
| ) |  | `[static]`

Search for all occurrences

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

Parameters:

  [in] | min | an MTime containing the new first frame
  [in] | max | an MTime containing the new last frame

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

MTime animationStartTime | ( |  | ) | `[static]`

Search for all occurrences

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.

Returns:
  An MTime instance specifying the first frame of the animation

MTime animationEndTime | ( |  | ) | `[static]`

Search for all occurrences

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.

Returns:
  An MTime instance specifying the last frame in the animation

MStatus setAnimationStartTime | ( | MTime | newStartTime | ) | `[static]`

Search for all occurrences

Set the value of the first frame in the animation.

Parameters:

  [in] | newStartTime | an MTime containing the new first frame

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

MStatus setAnimationEndTime | ( | MTime | newEndTime | ) | `[static]`

Search for all occurrences

Set the value of the last frame in the animation.

Parameters:

  [in] | newEndTime | an MTime containing the new last frame

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

MStatus setAnimationStartEndTime | ( | MTime | newStartTime,
|  | MTime | newEndTime
| ) |  | `[static]`

Search for all occurrences

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

Parameters:

  [in] | newStartTime | an MTime containing the new first frame
  [in] | newEndTime | an MTime containing the new last frame

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

MTime currentTime | ( |  | ) | `[static]`

Search for all occurrences

Return an MTime instance containing the current animation frame.

Returns:
  An MTime containing the current animation frame

Examples:
  animInfoCmd.cpp.

MStatus setCurrentTime | ( | const MTime & | newTime | ) | `[static]`

Search for all occurrences

Set the current animation frame.

Parameters:

  [in] | newTime | an MTime containing the new animation frame

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

double playbackSpeed | ( |  | ) | `[static]`

Search for all occurrences

Return the speed with with to play the animation.

Returns:
  The desired playback speed factor

MStatus setPlaybackSpeed | ( | double | newSpeed | ) | `[static]`

Search for all occurrences

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

Parameters:

  [in] | newSpeed | the new speed factor

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

MStatus playForward | ( |  | ) | `[static]`

Search for all occurrences

Start playing the current animation forwards.

Returns:
  - MS::kSuccess the animation started successfully
  - MS::kFailure the animation did not start

MStatus playBackward | ( |  | ) | `[static]`

Search for all occurrences

Start playing the current animation backwards.

Returns:
  - MS::kSuccess the animation started successfully
  - MS::kFailure the animation did not start

bool isPlaying | ( |  | ) | `[static]`

Search for all occurrences

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

Returns:
  - true the animation is currently playing
  - false the animation is not currently playing

MStatus stop | ( |  | ) | `[static]`

Search for all occurrences

Stop playing the current animation.

Returns:
  - MS::kSuccess the animation stopped successfully
  - MS::kFailure the animation did not stop

bool autoKeyMode | ( |  | ) | `[static]`

Search for all occurrences

Return the autoKeyMode.

Returns:
  - true the autoKeyMode is on
  - false the autoKeyMode is off

MStatus setAutoKeyMode | ( | bool | mode | ) | `[static]`

Search for all occurrences

Set the autoKeyMode.

Parameters:

  [in] | mode | a boolean specifying the new mode

Returns:
  - MS::kSuccess the autoKeyMode was set successfully
  - MS::kFailure the autoKeyMode was not changed

MFnAnimCurve::TangentType globalInTangentType | ( | MStatus * | ReturnStatus = `NULL` | ) | `[static]`

Search for all occurrences

Return the current global in tangent type.

Parameters:

  [out] | ReturnStatus | Status Code (see below)

Returns:
  - MFnAnimCurve::TangentType the current global in tangent type

Status Codes:
  - MS::kSuccess Success
  - MS::kFailure Could not find globalInTangent preference

MStatus setGlobalInTangentType | ( | const MFnAnimCurve::TangentType & | tangentType | ) | `[static]`

Search for all occurrences

Set the current global in tangent type.

Parameters:

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

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

MFnAnimCurve::TangentType globalOutTangentType | ( | MStatus * | ReturnStatus = `NULL` | ) | `[static]`

Search for all occurrences

Return the current global out tangent type.

Parameters:

  [out] | ReturnStatus | Status Code (see below)

Returns:
  The current global out tangent type

Status Codes:
  - MS::kSuccess Success
  - MS::kFailure Could not find globalOuttangent preference

MStatus setGlobalOutTangentType | ( | const MFnAnimCurve::TangentType & | tangentType | ) | `[static]`

Search for all occurrences

Set the current global out tangent type.

Parameters:

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

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

bool weightedTangents | ( | MStatus * | ReturnStatus = `NULL` | ) | `[static]`

Search for all occurrences

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

Parameters:

  [out] | ReturnStatus | Status Code

Returns:
  - 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 setWeightedTangents | ( | bool | weightState | ) | `[static]`

Search for all occurrences

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.

Parameters:

  [in] | weightState | a boolean specifying whether tangents should be weighted or not

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

MAnimControl MAnimControl MAnimControl MAnimControl MAnimControl MAnimControl MAnimControl MAnimControl MAnimControl MAnimControl
MAnimControl MAnimControl MAnimControl MAnimControl MAnimControl MAnimControl MAnimControl MAnimControl MAnimControl MAnimControl