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

- Class List
- Class Hierarchy
- Class Members

Static Public Member Functions

# MDGMessage Class Reference
OpenMaya - API module for common classes

This reference page is linked to from the following overview topics: Example C++ plug-in descriptions.

Search for all occurrences

## Detailed Description

Dependency graph messages.

This class is used to register callbacks for dependency graph messages.

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

- Time change
- Node Added
- Node Removed
- Connection made or broken

A filter can be specified for node added/removed messages. The default node type is "dependNode" which matches all nodes. 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.

`#include <MDGMessage.h>`

Inheritance diagram for MDGMessage:
[legend]

List of all members.

## Static Public Member Functions
static MCallbackId | addTimeChangeCallback (MMessage::MTimeFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
| This method registers a callback that is called whenever the time changes in the dependency graph.
static MCallbackId | addForceUpdateCallback (MMessage::MTimeFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
| This method registers a callback that is called after the time changes and after all nodes have been evaluated in the dependency graph.
static MCallbackId | addNodeAddedCallback (MMessage::MNodeFunction func, const MString &nodeType=kDefaultNodeType, void *clientData=NULL, MStatus *ReturnStatus=NULL)
| This method registers a callback that is called whenever a new node is added to the dependency graph.
static MCallbackId | addNodeRemovedCallback (MMessage::MNodeFunction func, const MString &nodeType=kDefaultNodeType, void *clientData=NULL, MStatus *ReturnStatus=NULL)
| This method registers a callback that is called whenever a new node is removed from the dependency graph.
static MCallbackId | addConnectionCallback (MMessage::MPlugFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
| This method registers a callback that is called whenever a connection is made or broken in the dependency graph.
static MCallbackId | addPreConnectionCallback (MMessage::MPlugFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
| This method registers a callback that is called whenever any connection is made or broken in the dependency graph.

## Member Function Documentation

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

Search for all occurrences

This method registers a callback that is called whenever the time changes in the dependency graph.

Parameters:

  [in] | func | the callback function

- time the new time
- 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

Examples:
  renderViewInteractiveRenderCmd.cpp.

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

Search for all occurrences

This method registers a callback that is called after the time changes and after all nodes have been evaluated in the dependency graph.

Parameters:

  [in] | func | the callback function

- time the new time
- 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 addNodeAddedCallback | ( | MMessage::MNodeFunction | func,
|  | const MString & | nodeType = `kDefaultNodeType`,
|  | void * | clientData = `NULL`,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | `[static]`

Search for all occurrences

This method registers a callback that is called whenever a new node is added to the dependency graph.

The nodeType argument allows you to specify the type of nodes that will trigger the callback. The default node type is "dependNode" which matches all nodes.

Parameters:

  [in] | func | the callback function

- node the new node
- clientData User defined data passed to the callback function

Parameters:

  [in] | nodeType | Type of node that will trigger the callback
  [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::kInvalidParameter An invalid nodeType was specified
  - MS::kInsufficientMemory No memory available
  - MS::kFailure Error adding callback

Examples:
  nodeCreatedCBCmd.cpp.

MCallbackId addNodeRemovedCallback | ( | MMessage::MNodeFunction | func,
|  | const MString & | nodeType = `kDefaultNodeType`,
|  | void * | clientData = `NULL`,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | `[static]`

Search for all occurrences

This method registers a callback that is called whenever a new node is removed from the dependency graph.

The nodeType argument allows you to specify the type of nodes that will trigger the callback. The default node type is "dependNode" which matches all nodes.

Parameters:

  [in] | func | the callback function

- node the node being removed
- clientData User defined data passed to the callback function

Parameters:

  [in] | nodeType | Type of node that will trigger the callback
  [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

Examples:
  deletedMsgCmd.cpp.

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

Search for all occurrences

This method registers a callback that is called whenever a connection is made or broken in the dependency graph.

This callback is triggered after the given connection has been made or broken, unlike the addPreConnectionCallback which is triggered before the operation.

Parameters:

  [in] | func | the callback function

- srcPlug Source plug of the connection
- destPlug Destination plug of the connection
- made true if a new connection was made, false if broken.
- 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 addPreConnectionCallback | ( | MMessage::MPlugFunction | func,
|  | void * | clientData = `NULL`,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  | `[static]`

Search for all occurrences

This method registers a callback that is called whenever any connection is made or broken in the dependency graph.

This callback is triggered before the given connection has been made or broken, unlike the addConnectionCallback which is triggered after the operation.

Parameters:

  [in] | func | the callback function

- srcPlug Source plug of the connection
- destPlug Destination plug of the connection
- made true if a new connection will be made, false if it will be broken.
- 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

MDGMessage MDGMessage MDGMessage MDGMessage MDGMessage MDGMessage MDGMessage MDGMessage MDGMessage MDGMessage
MDGMessage MDGMessage MDGMessage MDGMessage MDGMessage MDGMessage MDGMessage MDGMessage MDGMessage MDGMessage