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

- Class List
- Class Hierarchy
- Class Members

Static Public Member Functions

# MAnimMessage Class Reference
OpenMayaAnim - API module for animation

Search for all occurrences

## Detailed Description

Animation messages.

This class is used to register callbacks for animation messages.

To remove a callback use MMessage::removeCallback. All callbacks that are registered by a plug-in must be removed by that plug-in when it is unloaded. Failure to do so will result in a fatal error.

`#include <MAnimMessage.h>`

Inheritance diagram for MAnimMessage:
[legend]

List of all members.

## Static Public Member Functions
static MCallbackId | addAnimCurveEditedCallback (MMessage::MObjArray func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
| AnimCurve edited callback.
static MCallbackId | addAnimKeyframeEditedCallback (MMessage::MObjArray func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
| AnimCurve keyframe edited callback.
static MCallbackId | addNodeAnimKeyframeEditedCallback (MObject &animNode, MMessage::MNodeObjArray func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
| AnimCurve keyframe edited callback.
static MCallbackId | addAnimKeyframeEditCheckCallback (MMessage::MCheckPlugFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
| AnimCurve keyframe edit check callback.
static MCallbackId | addPreBakeResultsCallback (MMessage::MPlugsDGModFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
| Pre Bake Simulation callback.
static MCallbackId | addPostBakeResultsCallback (MMessage::MPlugsDGModFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
| Post Bake Simulation callback.
static MCallbackId | addDisableImplicitControlCallback (MMessage::MPlugsDGModFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
| Disable Implicit Control callback.
static MCallbackId | addAnimKeyframeEditedCallback (MObject &animNode, MMessage::MNodeObjArray func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
| This method is obsolete. This method is not available in Python.
static void | flushAnimKeyframeEditedCallbacks ()
| AnimCurve keyframe edited callback flush.
static const char * | className ()
| Returns the name of this class.

## Member Function Documentation

MCallbackId addAnimCurveEditedCallback | ( | MMessage::MObjArray | func,
|  | void * | clientData = `NULL`,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | `[static]`

Search for all occurrences

AnimCurve edited callback.

This method registers a callback that is called whenever an AnimCurve is edited.

Parameters:

  [in] | func | The callback function.

- editedCurves an array of AnimCurves which have been edited.
- clientData User defined data passed to the callback function.

Parameters:

  [in] | clientData | User defined data passed to the callback function.
  [out] | ReturnStatus | Status code.

Returns:
  Identifier used for removing the callback.

Status Codes:
  - MS::kSuccess Operation succeeded.
  - MS::kInsufficientMemory No memory available.
  - MS::kFailure Error adding callback.

MCallbackId addAnimKeyframeEditedCallback | ( | MMessage::MObjArray | func,
|  | void * | clientData = `NULL`,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | `[static]`

Search for all occurrences

AnimCurve keyframe edited callback.

This method registers a callback that is called whenever an a group of keys are modified.

The callback is invoked once per atomic change to single or group of keyframes. For example, if a user selects a group 5 of keys and moves them 5 units in the value axis, then a single callback event will be invoked with a MObject for each of the 5 keyframes. The MObjects can then be used in the MFnKeyframeDelta function set. Refer to MFnKeyframeDelta function set documentation for more info.

Parameters:

  [in] | func | the callback function

- editedKeys an array of keyframes that were edited.
- clientData User defined data passed to the callback function

Parameters:

  [in] | clientData | User defined data.
  [out] | ReturnStatus | status code

Returns:
  Identifier used for removing the callback.

Status Codes:
  - MS::kSuccess Operation succeeded
  - MS::kInsufficientMemory No memory available
  - MS::kFailure Error adding callback

MCallbackId addNodeAnimKeyframeEditedCallback | ( | MObject & | animNode,
|  | MMessage::MNodeObjArray | func,
|  | void * | clientData = `NULL`,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | `[static]`

Search for all occurrences

AnimCurve keyframe edited callback.

This method registers a callback that is called whenever an a group of keys are modified.

The callback is invoked once per atomic change to single or group of keyframes on the specified animation curve node. For example, if a user selects a group 5 of keys and moves them 5 units in the value axis, then a single callback event will be invoked with a MObject for each of the 5 keyframes. The MObjects can then be used in the MFnKeyframeDelta function set. Refer to MFnKeyframeDelta function set documentation for more info.

Parameters:

  [in] | animNode | the param curve node you want to watch.
  [in] | func | the callback function

- animNode The edited animation node.
- editedKeys an array of keyframes that were edited.
- clientData User defined data passed to the callback function

Parameters:

  [in] | clientData | User defined data.
  [out] | ReturnStatus | status code

Returns:
  Identifier used for removing the callback.

Status Codes:
  - MS::kSuccess Operation succeeded
  - MS::kInsufficientMemory No memory available
  - MS::kFailure Error adding callback

MCallbackId addAnimKeyframeEditCheckCallback | ( | MMessage::MCheckPlugFunction | func,
|  | void * | clientData = `NULL`,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | `[static]`

Search for all occurrences

AnimCurve keyframe edit check callback.

This method registers a callback that is used by the setKeyframe command to allow a user to consider the set keyframe request and cancel it if needed.

The callback method should return false to abort the keyframe setting.

Parameters:

  [in] | func | the callback function retCode return code from callback, setting this to false will abort the keyframe action plug the plug being keyframed clientData User defined data passed to the callback function
  [in] | clientData | User defined data.
  [out] | ReturnStatus | status code

Returns:
  Identifier used for removing the callback.

Status Codes:
  - MS::kSuccess Operation succeeded
  - MS::kInsufficientMemory No memory available
  - MS::kFailure Error adding callback
  Example

This example callback will reject any changes to plugs including 'translate' in their name.

        MAnimMessage m;
        m.addAnimKeyframeEditCheckCallback( check_callback );

        void check_callback(bool *retcode, MPlug& plug, void* clientData )
        {
            // Don't allow any keys to be set on attributes with 'translate' in them
            *retcode = ( plug.name().indexW( "translate" ) == -1 );
        }

MCallbackId addPreBakeResultsCallback | ( | MMessage::MPlugsDGModFunction | func,
|  | void * | clientData = `NULL`,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | `[static]`

Search for all occurrences

Pre Bake Simulation callback.

This method registers a callback that is called from bakeResults command before the simulation.

One example usage is handle the runup to the first frame in a dynamic system. If plugArray is set to zero length in the callback, the baking will be aborted.

Parameters:

  [in] | func | the callback function plugArray the plugs to be baked. The plugs can be replaced, but must have the same number of plugs. modifier the DGModifier. Used if bakeResults command is undone or redone. clientData User defined data passed to the callback function
  [in] | clientData | User defined data.
  [out] | ReturnStatus | status code

Returns:
  Identifier used for removing the callback.

Status Codes:
  - MS::kSuccess Operation succeeded
  - MS::kInsufficientMemory No memory available
  - MS::kFailure Error adding callback

MCallbackId addPostBakeResultsCallback | ( | MMessage::MPlugsDGModFunction | func,
|  | void * | clientData = `NULL`,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | `[static]`

Search for all occurrences

Post Bake Simulation callback.

This method registers a callback that is called from bakeResults command after the simulation.

If the plugArray is replaced, then the anim curves created from baking will be connected to the new plugs.

Parameters:

  [in] | func | the callback function plugArray the baked plugs to which the resulting anim curves will be connected. The plugs can be replaced, but must have the same number of plugs. modifier the DGModifier. Used if bakeResults command is undone or redone. clientData User defined data passed to the callback function
  [in] | clientData | User defined data.
  [out] | ReturnStatus | status code

Returns:
  Identifier used for removing the callback.

Status Codes:
  - MS::kSuccess Operation succeeded
  - MS::kInsufficientMemory No memory available
  - MS::kFailure Error adding callback

MCallbackId addDisableImplicitControlCallback | ( | MMessage::MPlugsDGModFunction | func,
|  | void * | clientData = `NULL`,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | `[static]`

Search for all occurrences

Disable Implicit Control callback.

This method registers a callback that is called from bakeResults command after baking operation is completed, if disableImplicitControl is enabled.

One example usage of this callback is to create the anim curve that is used to drive Maya rigidbody's bakeSimulationIndex, which defines if the rigid body should take its input from anim curve or rigid body simulation.

Parameters:

  [in] | func | the callback function plugArray the baked plugs. modifier the DGModifier. Used if bakeResults command is undone or redone. clientData User defined data passed to the callback function
  [in] | clientData | User defined data.
  [out] | ReturnStatus | status code

Returns:
  Identifier used for removing the callback.

Status Codes:
  - MS::kSuccess Operation succeeded
  - MS::kInsufficientMemory No memory available
  - MS::kFailure Error adding callback

MCallbackId addAnimKeyframeEditedCallback | ( | MObject & | animNode,
|  | MMessage::MNodeObjArray | func,
|  | void * | clientData = `NULL`,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | `[static]`

Search for all occurrences

This method is obsolete. This method is not available in Python.

Deprecated:
  Use MAnimMessage::addNodeAnimKeyframeEditedCallback instead.

Parameters:

  [in] | animNode | the param curve node you want to watch.
  [in] | func | The callback function.
  [in] | clientData | User defined data.
  [out] | ReturnStatus | Status code.

Returns:
  Identifier used for removing the callback.

void flushAnimKeyframeEditedCallbacks | ( |  | ) | `[static]`

Search for all occurrences

AnimCurve keyframe edited callback flush.

Animation keyframe edited callbacks are queued to only be issued on an idle event.

There may be times when it is desired to issue the callback at a specific time. This method provides this functionality. It will flush all animation keyframe edited callbacks and force them to issue their callbacks with the data contained within.

const char * className | ( |  | ) | `[static]`

Search for all occurrences

Returns the name of this class.

Returns:
  The name of this class.

Reimplemented from MMessage.

MAnimMessage MAnimMessage MAnimMessage MAnimMessage MAnimMessage MAnimMessage MAnimMessage MAnimMessage MAnimMessage MAnimMessage
MAnimMessage MAnimMessage MAnimMessage MAnimMessage MAnimMessage MAnimMessage MAnimMessage MAnimMessage MAnimMessage MAnimMessage