C++ API Reference
MNodeMessage Class Reference

Dependency node messages. More...

#include <MNodeMessage.h>

+ Inheritance diagram for MNodeMessage:

Public Types

enum  AttributeMessage {
  kConnectionMade = 0x01, kConnectionBroken = 0x02, kAttributeEval = 0x04, kAttributeSet = 0x08,
  kAttributeLocked = 0x10, kAttributeUnlocked = 0x20, kAttributeAdded = 0x40, kAttributeRemoved = 0x80,
  kAttributeRenamed = 0x100, kAttributeKeyable = 0x200, kAttributeUnkeyable = 0x400, kIncomingDirection = 0x800,
  kAttributeArrayAdded = 0x1000, kAttributeArrayRemoved = 0x2000, kOtherPlugSet = 0x4000, kLast = 0x8000
}
 The type of attribute changed/addedOrRemoved messages that has occurred. More...
 
enum  KeyableChangeMsg { kKeyChangeInvalid = 0, kMakeKeyable, kMakeUnkeyable, kKeyChangeLast }
 Allows you to prevent attributes from becoming (un)keyable. More...
 
typedef void(* MAttr2PlugFunction) (MNodeMessage::AttributeMessage msg, MPlug &plug, MPlug &otherPlug, void *clientData)
 Pointer to an AttributeMessage callback which takes two plugs. More...
 
typedef void(* MAttrPlugFunction) (MNodeMessage::AttributeMessage msg, MPlug &plug, void *clientData)
 Pointer to an AttributeMessage callback which takes a single plug. More...
 
typedef void(* MKeyableFunction) (MPlug &plug, void *clientData, MNodeMessage::KeyableChangeMsg msg, bool &decision)
 Pointer to a change in keyability callback function. More...
 
- 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...
 

Static Public Member Functions

static MCallbackId addAttributeChangedCallback (MObject &node, MNodeMessage::MAttr2PlugFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 This method registers a callback for attribute changed messages. More...
 
static MCallbackId addAttributeAddedOrRemovedCallback (MObject &node, MNodeMessage::MAttrPlugFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 Registers callbacks for attribute add/removed messages. More...
 
static MCallbackId addNodeDirtyCallback (MObject &node, MMessage::MNodeFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 Registers a callback for node dirty messages. More...
 
static MCallbackId addNodeDirtyPlugCallback (MObject &node, MMessage::MNodePlugFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 Registers a callback for node dirty messages. More...
 
static MCallbackId addNameChangedCallback (MObject &node, MMessage::MNodeStringFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 Registers a callback for name changed messages. More...
 
static MCallbackId addUuidChangedCallback (MObject &node, MMessage::MNodeUuidFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 Registers a callback for UUID changed messages. More...
 
static MCallbackId addNodeAboutToDeleteCallback (MObject &node, MMessage::MNodeModifierFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 Registers a callback which will get called when a node is about to be deleted. More...
 
static MCallbackId addNodePreRemovalCallback (MObject &node, MMessage::MNodeFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 Registers a callback which will get called before a node is deleted. More...
 
static MCallbackId addNodeDestroyedCallback (MObject &node, MMessage::MBasicFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 NodeDestroyed callback. More...
 
static MCallbackId addKeyableChangeOverride (MPlug &plug, MNodeMessage::MKeyableFunction func, void *clientData=NULL, MStatus *status=NULL)
 Attribute keyable state change override. More...
 
static const char * className ()
 Returns the name of this class. More...
 
static MCallbackId addNodeDirtyCallback (MObject &node, MMessage::MBasicFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 This method is obsolete. More...
 
static MCallbackId addNodeDirtyCallback (MObject &node, MMessage::MNodePlugFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 This method is obsolete. More...
 
static MCallbackId addNameChangedCallback (MObject &node, MMessage::MNodeFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 This method is obsolete. More...
 
static MCallbackId addNodeAboutToDeleteCallback (MObject &node, MMessage::MModifierFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 This method is obsolete. 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...
 

Detailed Description

Dependency node messages.

This class is used to register callbacks for dependency node messages of specific dependency nodes.

There are 5 add callback methods which will add callbacks for the following messages

  • Attribute Changed
  • Attribute Added or Removed
  • Node Dirty
  • Name Changed
  • UUID Changed

The first parameter passed to each of the add callback methods is the dependency node that will trigger the callback.

Callbacks that are registered for attribute changed/addedOrRemoved messages will be passed an AttributeMessage value as a parameter. This value indicates the type of attribute message that has occurred. See the AttributeMessage enum for all available messages.

Each method returns an id which is used to remove the callback.

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 Typedef Documentation

typedef void(* MAttr2PlugFunction) (MNodeMessage::AttributeMessage msg, MPlug &plug, MPlug &otherPlug, void *clientData)

Pointer to an AttributeMessage callback which takes two plugs.

Parameters
[in]msgType of message which caused the function to be called.
[in,out]plugFirst plug. Meaning depends upon the specific message which invoked the callback.
[in,out]otherPlugSecond plug. Meaning depends upon the specific message which invoked the callback.
[in]clientDataPointer to user-defined data supplied when the callback was registered.
typedef void(* MAttrPlugFunction) (MNodeMessage::AttributeMessage msg, MPlug &plug, void *clientData)

Pointer to an AttributeMessage callback which takes a single plug.

Parameters
[in]msgType of message which caused the function to be called.
[in,out]plugMeaning depends upon the specific message which invoked the callback.
[in]clientDataPointer to user-defined data supplied when the callback was registered.
typedef void(* MKeyableFunction) (MPlug &plug, void *clientData, MNodeMessage::KeyableChangeMsg msg, bool &decision)

Pointer to a change in keyability callback function.

Parameters
[in,out]plugThe plug whose keyability is changing.
[in]clientDataPointer to user-defined data supplied when the callback was registered.
[in]msgSpecifies how the plug's keyability is changing.
[out]decisionCallback sets this true to accept the change, false to reject it.

Member Enumeration Documentation

The type of attribute changed/addedOrRemoved messages that has occurred.

Enumerator
kConnectionMade 

a connection has been made to an attribute of this node

kConnectionBroken 

a connection has been broken for an attribute of this node

kAttributeEval 

an attribute of this node has been evaluated

kAttributeSet 

an attribute value of this node has been set

kAttributeLocked 

an attribute of this node has been locked

kAttributeUnlocked 

an attribute of this node has been unlocked

kAttributeAdded 

an attribute has been added to this node

kAttributeRemoved 

an attribute has been removed from this node

kAttributeRenamed 

an attribute of this node has had an alias added, removed, or renamed

kAttributeKeyable 

an attribute of this node has been marked keyable

kAttributeUnkeyable 

an attribute of this node has been marked unkeyable

kIncomingDirection 

the connection was coming into the node

kAttributeArrayAdded 

an array attribute has been added to this node

kAttributeArrayRemoved 

an array attribute has been removed from this node

kOtherPlugSet 

the otherPlug data has been set

kLast 

last value of the enum

Allows you to prevent attributes from becoming (un)keyable.

Enumerator
kKeyChangeInvalid 

 

kMakeKeyable 

 

kMakeUnkeyable 

 

kKeyChangeLast 

 

Member Function Documentation

OPENMAYA_MAJOR_NAMESPACE_OPEN MCallbackId addAttributeChangedCallback ( MObject node,
MNodeMessage::MAttr2PlugFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

This method registers a callback for attribute changed messages.

See the AttributeChanged enum for a list of all possible messages that will trigger the callback.

Note: Attribute Changed messages will not be generated while Maya is either in playback or scrubbing modes. If you need to do something during playback or scrubbing you will have to register a callback for the timeChanged message which is the only message message that is sent during those modes.

The callback function will be passed the type of attribute message that has occurred, the plug(s) for the attributes, and any client data that the user wishes to pass in.

Example callback ( prints out a message when a connection is made or broken ) :

void userCB( MNodeMessage::AttributeMessage msg, MPlug & plug,
MPlug & otherPlug, void* )
{
cout << "Connection made ";
} else if ( msg & MNodeMessage::kConnectionBroken ) {
cout << "Connection broken ";
} else {
return;
}
cout << plug.info();
cout << " <-- " << otherPlug.info();
} else {
cout << " --> " << otherPlug.info();
}
}
cout << endl;
}
Parameters
[in]nodethe node to register the callback for. If this is a NULL MObject then the callback applies to all nodes.
[in]functhe callback function, which takes the following parameters:
  • msg the kind of attribute change triggering the callback
  • plug the node's plug where the connection changed
  • otherPlug the plug opposite the node's plug where the connection changed
  • clientData User defined data passed to the callback function
[in]clientDataUser defined data that will be 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
Examples:
apiMeshShape/apiMeshShape.cpp, cgFx/cgfxShaderNode.cpp, and nodeMessageCmd/nodeMessageCmd.cpp.
MCallbackId addAttributeAddedOrRemovedCallback ( MObject node,
MNodeMessage::MAttrPlugFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

Registers callbacks for attribute add/removed messages.

This is a more specific version of addAttributeChanged as only attribute added and attribute removed messages will trigger the callback.

Parameters
[in]nodethe node to register the callback for
[in]functhe callback function, which takes the following parameters:
  • msg the kind of attribute change triggering the callback
  • plug the node's plug where the connection changed
  • clientData User defined data passed to the callback function
[in]clientDataUser defined data that will be 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
Examples:
cgFx/cgfxShaderNode.cpp.
MCallbackId addNodeDirtyCallback ( MObject node,
MMessage::MNodeFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

Registers a callback for node dirty messages.

Parameters
[in]nodethe node to register the callback for
[in]functhe callback function, which takes the following parameters:
  • node The node that has become dirty
  • clientData User defined data passed to the callback function
[in]clientDataUser defined data that will be 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 addNodeDirtyPlugCallback ( MObject node,
MMessage::MNodePlugFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

Registers a callback for node dirty messages.

This callback provides the plug on the node that was dirtied. Only provides dirty information on input plugs.

Parameters
[in]nodethe node to register the callback for
[in]functhe callback function, which takes the following parameters:
  • node The node that has become dirty
  • plug The plug on the node that has become dirty
  • clientData User defined data passed to the callback function
[in]clientDataUser defined data that will be 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
Examples:
gpuCache/gpuCacheSubSceneOverride.cpp.
MCallbackId addNameChangedCallback ( MObject node,
MMessage::MNodeStringFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

Registers a callback for name changed messages.

Parameters
[in]nodethe node. If this is a NULL MObject then the callback applies to all node name changes.
[in]functhe callback function, which takes the following parameters:
  • node the node
  • prevName the previous name of the node
  • clientData User defined data passed to the callback function
[in]clientDataUser defined data that will be 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 addUuidChangedCallback ( MObject node,
MMessage::MNodeUuidFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

Registers a callback for UUID changed messages.

Parameters
[in]nodethe node. If this is a NULL MObject then the callback applies to all node UUID changes.
[in]functhe callback function, which takes the following parameters:
  • node the node
  • prevUuid the previous UUID of the node
  • clientData User defined data passed to the callback function
[in]clientDataUser defined data that will be 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 addNodeAboutToDeleteCallback ( MObject node,
MMessage::MNodeModifierFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

Registers a callback which will get called when a node is about to be deleted.

The callback will be passed the MDGModifer that will be used to delete the node. This modifier can be used to do any DG modifications, such as disconnections, before the node is deleted. These operations are also stored and performed when the deletion operation is undone or redone.

The callback registered with this method will only get called when the deletion operation is first performed. Undos and redos will be handled solely through the MDGModifier which was passed to the callback on the original deletion. If you also wish to receive notification of deletion events when they are redone, you should register an additional callback using addNodePreRemovalCallback().

When a node is deleted Maya automatically breaks all connections to that node. This process takes place after the callback has been called. This means that if you use the passed-in MDGModifier to break any connections to the node you must be sure to call the modifier's doIt() method before returning from the callback. Otherwise Maya will see that the connections still exist and try to delete them again, which can lead to errors.

The example below shows a callback function which takes the connection coming into the node's input attribute and reconnects it to all of the plugs connected to the node's output attribute:

import maya.OpenMaya as om
def rewire(node, dgmod, data):
nodefn = om.MFnDependencyNode(node)
try:
# Find the input plug.
inPlug = nodefn.findPlug('input')
# Get the incoming connections.
srcs = om.MPlugArray()
inPlug.connectedTo(srcs, True, False)
if srcs.length() > 0:
srcPlug = srcs[0]
outPlug = nodefn.findPlug('output')
dests = om.MPlugArray()
outPlug.connectedTo(dests, False, True)
if dests.length() > 0:
# Now that we know we have a valid flow-through
# connection, disconnect the source from this node.
dgmod.disconnect(srcPlug, inPlug)
# Disconnect all of destinations from this node.
for i in range(dests.length()):
dgmod.disconnect(outPlug, dests[i])
# Force our disconnections to be done now.
dgmod.doIt()
# Make a direct connection from the source to each of
# the destinations.
for i in range(dests.length()):
dgmod.connect(srcPlug, dests[i])
except:
# This node does not have an 'input' plug, or does not have
# an 'output' plug, so let's ignore it.
pass

Note that it uses the passed-in MDGModifier to perform all the disconnections and connections. This ensures that if the deletion is undone or redone then all of the connections will be restored correctly.

After it is done breaking connections, the callback calls the modifier's doIt() method to commit those disconnections. As noted above, this is necessary to ensure that Maya doesn't see the connections and try to break them again later on.

Parameters
[in]nodethe node to register the callback for
[in]functhe callback function, which takes the following parameters:
  • node the node that will be deleted
  • modifier DG modifier used to delete the node
  • clientData User defined data passed to the callback function
[in]clientDataUser defined data that will be 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
Examples:
deletedMsgCmd/deletedMsgCmd.cpp.
MCallbackId addNodePreRemovalCallback ( MObject node,
MMessage::MNodeFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

Registers a callback which will get called before a node is deleted.

This callback is called before connections on the node are removed. Unlike the aboutToDelete callback, this callback will be invoked whenever the node is deleted, even during a redo.

Pre-removal and aboutToDelete callbacks serve different purposes. If DG changes need to be made when a node is deleted, the aboutToDelete callback should be used to add undoable operations to an MDGModifier to perform these changes. When the desired actions cannot be accomplished using the MDGModifier passed to the aboutToDelete callback, this callback can be used to receive notification of the deletion event, even during redo.

Note that this callback method should not perform any DG operations.

Parameters
[in]nodethe node to register the callback for
[in]functhe callback function, which takes the following parameters:
  • node the node that is being deleted
  • clientData User defined data passed to the callback function
[in]clientDataUser defined data that will be 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
Examples:
deletedMsgCmd/deletedMsgCmd.cpp.
MCallbackId addNodeDestroyedCallback ( MObject node,
MMessage::MBasicFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

NodeDestroyed callback.

Registers a callback which will get called when a node's destructor is called.

Parameters
[in]nodethe node to register the callback for
[in]functhe callback function, which takes the following parameters:
  • clientData User defined data passed to the callback function
[in]clientDataUser defined data that will be 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 addKeyableChangeOverride ( MPlug plug,
MNodeMessage::MKeyableFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

Attribute keyable state change override.

This method registers a callback that is invoked by any class that changes the keyable state of an attribute.

When the callback is invoked, the API programmer can make a decision on how to handle the given keyable change event. The programmer can either accept the the keyable state change by returning a decision == 'true' or reject it by returning decision == 'false'.

Note: you can only attach one callback keyable change override callback per attribute. It is an error to attach more than one callback to the same attribute.

Parameters
[in]plugThe plug to which to attach the callback.
[in]functhe callback function, which takes the following parameters:
  • plug - The plug that triggered the callback.
  • clientData - User defined data passed to the callback function.
  • eventType - Description of the event.
  • decision - Return true to accept the keyable state change or false to reject it.
[in]clientDataUser defined data passed back to the user.
[in]ReturnStatusstatus code
Status Codes:
  • MS::kFailure - Error registering callback. This can occur when a global watcher is already attached to the node.
  • MS::kInsufficientMemory - Not enough memory to register the callback.
  • MS::kInvalidParameter - The given node is not a valid node to register the callback on.
  • MS::kSuccess - Callback successfully added.
const char * className ( )
static

Returns the name of this class.

Returns
The name of this class.
MCallbackId addNodeDirtyCallback ( MObject node,
MMessage::MBasicFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

This method is obsolete.

This method is not available in Python.

[as of Maya 2019]

Deprecated:
Use the version which takes a callback function of type MMessage::MNodeFunction instead.
Parameters
[in]node
[in]func
[in]clientData
[out]ReturnStatus
MCallbackId addNodeDirtyCallback ( MObject node,
MMessage::MNodePlugFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

This method is obsolete.

This method is not available in Python.

[as of Maya 2019]

Deprecated:
Use the MNodeMessage::addNodeDirtyPlugCallback method instead.
Parameters
[in]node
[in]func
[in]clientData
[out]ReturnStatus
MCallbackId addNameChangedCallback ( MObject node,
MMessage::MNodeFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

This method is obsolete.

This method is not available in Python.

[as of Maya 2019]

Deprecated:
Use the version which takes a callback function of type MMessage::MNodeStringFunction instead.
MCallbackId addNodeAboutToDeleteCallback ( MObject node,
MMessage::MModifierFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

This method is obsolete.

This method is not available in Python.

[as of Maya 2019]

Deprecated:
Use the version which takes a callback function of type MMessage::MNodeModifierFunction instead.
Parameters
[in]node
[in]func
[in]clientData
[out]ReturnStatus

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