C++ API Reference
MAnimMessage Class Reference

Animation messages. More...

#include <MAnimMessage.h>

+ Inheritance diagram for MAnimMessage:

Static Public Member Functions

static MCallbackId addAnimCurveEditedCallback (MMessage::MObjArray func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 AnimCurve edited callback. More...
 
static MCallbackId addAnimKeyframeEditedCallback (MMessage::MObjArray func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 AnimCurve keyframe edited callback. More...
 
static MCallbackId addNodeAnimKeyframeEditedCallback (MObject &animNode, MMessage::MNodeObjArray func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 AnimCurve keyframe edited callback. More...
 
static MCallbackId addAnimKeyframeEditCheckCallback (MMessage::MCheckPlugFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 AnimCurve keyframe edit check callback. More...
 
static MCallbackId addPreBakeResultsCallback (MMessage::MPlugsDGModFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 Pre Bake Simulation callback. More...
 
static MCallbackId addPostBakeResultsCallback (MMessage::MPlugsDGModFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 Post Bake Simulation callback. More...
 
static MCallbackId addDisableImplicitControlCallback (MMessage::MPlugsDGModFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 Disable Implicit Control callback. More...
 
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. More...
 
static void flushAnimKeyframeEditedCallbacks ()
 AnimCurve keyframe edited callback flush. More...
 
static const char * className ()
 Returns the name of this class. More...
 
- Static Public Member Functions inherited from MMessage
static MStatus removeCallback (MCallbackId id)
 Remove the specified callback from maya. More...
 
static MStatus removeCallbacks (MCallbackIdArray &ids)
 Remove all of the specified callbacks from maya. More...
 
static MCallbackId currentCallbackId (MStatus *ReturnStatus=NULL)
 Return the callback ID of the currently executing callback. More...
 
static MStatus nodeCallbacks (MObject &node, MCallbackIdArray &ids)
 Returns a list of callback IDs associated registered to a given node. More...
 
static void setRegisteringCallableScript ()
 Mark this MMessage object as one that will be passed callbacks defined in script.
 
static bool registeringCallableScript ()
 Return true if this MMessage object has its callbacks defined in script.
 
static void stopRegisteringCallableScript ()
 Stop this MMessage object from being passed. More...
 
static const char * className ()
 Returns the name of this class. More...
 
static MStatus removeCallbacks (MIntArray &ids)
 This method is obsolete. More...
 
static MStatus nodeCallbacks (MObject &node, MIntArray &ids)
 This method is obsolete. More...
 

Additional Inherited Members

- Public Types inherited from MMessage
enum  Action { kDefaultAction, kDoNotDoAction, kDoAction }
 Callback result action codes. More...
 
typedef void(* MBasicFunction) (void *clientData)
 Pointer to a basic callback function. More...
 
typedef void(* MElapsedTimeFunction) (float elapsedTime, float lastTime, void *clientData)
 Pointer to an elapsed time callback function. More...
 
typedef void(* MCheckFunction) (bool *retCode, void *clientData)
 Pointer to callback function which returns a true/false result. More...
 
typedef void(* MCheckFileFunction) (bool *retCode, MFileObject &file, void *clientData)
 Pointer to a callback function which takes a file object and returns a result. More...
 
typedef void(* MCheckPlugFunction) (bool *retCode, MPlug &plug, void *clientData)
 Pointer to a callback function which takes a plug and returns a result. More...
 
typedef void(* MComponentFunction) (MUintArray componentIds[], unsigned int count, void *clientData)
 Pointer to a callback function which takes an array of component ids. More...
 
typedef void(* MNodeFunction) (MObject &node, void *clientData)
 Pointer to a callback function which takes a dependency node. More...
 
typedef void(* MStringFunction) (const MString &str, void *clientData)
 Pointer to callback function which takes a string. More...
 
typedef void(* MTwoStringFunction) (const MString &str1, const MString &str2, void *clientData)
 Pointer to a callback function which takes two strings. More...
 
typedef void(* MThreeStringFunction) (const MString &str1, const MString &str2, const MString &str3, void *clientData)
 Pointer to a callback function which takes three strings. More...
 
typedef void(* MStringIntBoolIntFunction) (const MString &str, unsigned int index, bool flag, unsigned int type, void *clientData)
 Pointer to callback function which takes a string, an index, a flag and a type. More...
 
typedef void(* MStringIndexFunction) (const MString &, unsigned int index, void *clientData)
 Pointer to callback function which takes a string and index. More...
 
typedef void(* MNodeStringBoolFunction) (MObject &node, const MString &, bool, void *clientData)
 Pointer to a callback function which takes a node, a string and a boolean. More...
 
typedef void(* MStateFunction) (bool state, void *clientData)
 Pointer to a callback function which takes a boolean state. More...
 
typedef void(* MTimeFunction) (MTime &time, void *clientData)
 Pointer to callback function which takes a time. More...
 
typedef void(* MPlugFunction) (MPlug &srcPlug, MPlug &destPlug, bool made, void *clientData)
 Pointer to plug connection callback function. More...
 
typedef void(* MNodePlugFunction) (MObject &node, MPlug &plug, void *clientData)
 Pointer to a callback function which takes a dependency node and a plug. More...
 
typedef void(* MNodeStringFunction) (MObject &node, const MString &str, void *clientData)
 Pointer to a callback function which takes a dependency node and a string. More...
 
typedef void(* MParentChildFunction) (MDagPath &child, MDagPath &parent, void *clientData)
 Pointer to to a callback function which takes two DAG nodes in a parent/child relationship. More...
 
typedef void(* MModifierFunction) (MDGModifier &modifier, void *clientData)
 Pointer to a callback function which takes a DG modifier. More...
 
typedef void(* MStringArrayFunction) (const MStringArray &strs, void *clientData)
 Pointer to a callback function which takes a string array. More...
 
typedef void(* MNodeModifierFunction) (MObject &node, MDGModifier &modifier, void *clientData)
 Pointer to a callback function which takes a dependency node and a DG modifier. More...
 
typedef void(* MObjArray) (MObjectArray &objects, void *clientData)
 Pointer to a callback function which takes an array of objects. More...
 
typedef void(* MNodeObjArray) (MObject &node, MObjectArray &objects, void *clientData)
 Pointer to a callback function which takes a dependency node and an array of objects. More...
 
typedef void(* MStringNode) (const MString &str, MObject &node, void *clientData)
 Pointer to a callback function which takes a string and a dependency node. More...
 
typedef void(* MCameraLayerFunction) (MObject &cameraSetNode, unsigned int multiIndex, bool added, void *clientData)
 Pointer to a callback function which takes a dependency node, an unsigned integer, and a boolean value. More...
 
typedef void(* MCameraLayerCameraFunction) (MObject &cameraSetNode, unsigned int multiIndex, MObject &oldCamera, MObject &newCamera, void *clientData)
 Pointer to a callback function which takes a dependency node, an unsigned integer, and two camera transform nodes. More...
 
typedef void(* MConnFailFunction) (MPlug &srcPlug, MPlug &destPlug, const MString &srcPlugName, const MString &dstPlugName, void *clientData)
 Pointer to connection-failed callback function. More...
 
typedef void(* MPlugsDGModFunction) (MPlugArray &plugs, MDGModifier &modifier, void *clientData)
 Pointer to a callback function which takes an array of MPlugs and an MDGModifier. More...
 
typedef void(* MNodeUuidFunction) (MObject &node, const MUuid &uuid, void *clientData)
 Pointer to a callback function which takes a dependency node and a UUID. More...
 
typedef Action(* MCheckNodeUuidFunction) (bool doAction, MObject &node, MUuid &uuid, void *clientData)
 Pointer to a callback function which takes a dependency node and a UUID, and returns a result. More...
 
typedef void(* MObjectFileFunction) (const MObject &object, const MFileObject &file, void *clientData)
 Pointer to a callback function which takes an object and a file object. More...
 
typedef void(* MCheckObjectFileFunction) (bool *retCode, const MObject &referenceNode, MFileObject &file, void *clientData)
 Pointer to a callback function which takes an object and a file object and returns a result. More...
 
typedef void(* MRenderTileFunction) (int originX, int originY, int tileMaxX, int tileMaxY, const void *tileData)
 Pointer to a callback function which receives origin, size and image data. More...
 

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.

Member Function Documentation

OPENMAYA_MAJOR_NAMESPACE_OPEN 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:
  • 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

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:
  • 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

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:
  • 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

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:
  • 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.

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:
  • 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

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:
  • 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

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:
  • 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

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.

The documentation for this class was generated from the following files: