Static Public Member Functions

MAnimMessage Class Reference

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:
Inheritance graph
[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]

AnimCurve edited callback.

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

Parameters:
[in]funcThe callback function.
  • editedCurves an array of AnimCurves which have been edited.
  • clientData User defined data passed to the callback function.
Parameters:
[in]clientDataUser defined data passed to the callback function.
[out]ReturnStatusStatus code.
Returns:
Identifier used for removing the callback.
Status Codes:
MCallbackId addAnimKeyframeEditedCallback ( MMessage::MObjArray  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
) [static]

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]functhe callback function
  • editedKeys an array of keyframes that were edited.
  • clientData User defined data passed to the callback function
Parameters:
[in]clientDataUser defined data.
[out]ReturnStatusstatus code
Returns:
Identifier used for removing the callback.
Status Codes:
MCallbackId addNodeAnimKeyframeEditedCallback ( MObject animNode,
MMessage::MNodeObjArray  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
) [static]

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]animNodethe param curve node you want to watch.
[in]functhe 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]clientDataUser defined data.
[out]ReturnStatusstatus code
Returns:
Identifier used for removing the callback.
Status Codes:
MCallbackId addAnimKeyframeEditCheckCallback ( MMessage::MCheckPlugFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
) [static]

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]functhe 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]clientDataUser defined data.
[out]ReturnStatusstatus code
Returns:
Identifier used for removing the callback.
Status Codes:
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]

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]functhe 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]clientDataUser defined data.
[out]ReturnStatusstatus code
Returns:
Identifier used for removing the callback.
Status Codes:
MCallbackId addPostBakeResultsCallback ( MMessage::MPlugsDGModFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
) [static]

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]functhe 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]clientDataUser defined data.
[out]ReturnStatusstatus code
Returns:
Identifier used for removing the callback.
Status Codes:
MCallbackId addDisableImplicitControlCallback ( MMessage::MPlugsDGModFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
) [static]

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]functhe 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]clientDataUser defined data.
[out]ReturnStatusstatus code
Returns:
Identifier used for removing the callback.
Status Codes:
MCallbackId addAnimKeyframeEditedCallback ( MObject animNode,
MMessage::MNodeObjArray  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
) [static]

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

Deprecated:
Use MAnimMessage::addNodeAnimKeyframeEditedCallback instead.
Parameters:
[in]animNodethe param curve node you want to watch.
[in]funcThe callback function.
[in]clientDataUser defined data.
[out]ReturnStatusStatus code.
Returns:
Identifier used for removing the callback.
void flushAnimKeyframeEditedCallbacks ( ) [static]

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]

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