C++ API Reference

UI messages. More...

#include <MUiMessage.h>

+ Inheritance diagram for MUiMessage:

Static Public Member Functions

static MCallbackId addUiDeletedCallback (const MString &uiName, MMessage::MBasicFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 This method registers a callback for UI deleted messages. More...
 
static MCallbackId addCameraChangedCallback (const MString &panelName, MMessage::MStringNode func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 This method registers a callback for cameras being changed in 3d views. More...
 
static MCallbackId add3dViewDestroyMsgCallback (const MString &panelName, MMessage::MStringFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 This method registers a callback for when a particular 3d view gets destroyed. More...
 
static MCallbackId add3dViewPreRenderMsgCallback (const MString &panelName, MMessage::MStringFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 This method registers a callback for when a particular 3d view is about to render it's contents. More...
 
static MCallbackId add3dViewPostRenderMsgCallback (const MString &panelName, MMessage::MStringFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 This method registers a callback for when the 3d view is about to display it's rendered contents to the viewport. More...
 
static MCallbackId add3dViewPreMultipleDrawPassMsgCallback (const MString &panelName, MUiMessage::MStringIndexFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 This method registers a callback for when a particular 3d view's specific pass is about to be drawn when multiple drawing is enabled. More...
 
static MCallbackId add3dViewPostMultipleDrawPassMsgCallback (const MString &panelName, MUiMessage::MStringIndexFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 This method registers a callback for when a particular 3d view's specified pass is finshed when multiple drawing is enabled. More...
 
static MCallbackId add3dViewRendererChangedCallback (const MString &panelName, MMessage::MThreeStringFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 This method registers a callback for when the renderer for a particular 3d view changes. More...
 
static MCallbackId add3dViewRenderOverrideChangedCallback (const MString &panelName, MMessage::MThreeStringFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 This method registers a callback for when the render override for a particular 3d view changes. 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

UI messages.

This class is used to register callbacks to track the deletion of UI objects.

The first parameter passed to the add callback method is the name of the UI that will trigger the callback.

The 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 Function Documentation

OPENMAYA_MAJOR_NAMESPACE_OPEN MCallbackId addUiDeletedCallback ( const MString uiName,
MMessage::MBasicFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

This method registers a callback for UI deleted messages.

The callback function will be passed any client data that was provided when the callback was registered.

Parameters
[in]uiNamethe name of the UI object 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::kUnknownParameter The named UI object could not be found
  • MS::kInsufficientMemory No memory available
  • MS::kFailure Error adding callback
Examples:
gpuCache/gpuCacheShapeNode.cpp.
MCallbackId addCameraChangedCallback ( const MString panelName,
MMessage::MStringNode  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

This method registers a callback for cameras being changed in 3d views.

The callback is called when the camera changes for the given panel, not when attributes on the panel's camera change.

The callback function will be passed any client data that was provided when the callback was registered.

Parameters
[in]panelNameName of panel to which to attach the callback.
[in]functhe callback function, which takes the following parameters:
  • panelName The name of the panel that had the camera change.
  • camera The current camera used by the panel.
  • 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::kUnknownParameter The named UI object could not be found
  • MS::kInsufficientMemory No memory available
  • MS::kFailure Error adding callback
MCallbackId add3dViewDestroyMsgCallback ( const MString panelName,
MMessage::MStringFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

This method registers a callback for when a particular 3d view gets destroyed.

The callback is called before the destruction of the view.

The callback function will be passed any client data that was provided when the callback was registered.

Parameters
[in]panelNameName of panel to which to attach the callback.
[in]functhe callback function, which takes the following parameters:
  • panelName The name of the panel that contains the 3d view.
  • 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::kUnknownParameter The named UI object could not be found
  • MS::kInsufficientMemory No memory available
  • MS::kFailure Error adding callback
Examples:
lensDistortionCallback/lensDistortionCallback.cpp, and viewCallbackTest/viewCallbackTest.cpp.
MCallbackId add3dViewPreRenderMsgCallback ( const MString panelName,
MMessage::MStringFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

This method registers a callback for when a particular 3d view is about to render it's contents.

It is called before the scene is drawn, but after the background has been drawn.

The callback function will be passed any client data that was provided when the callback was registered.

Parameters
[in]panelNameName of panel to which to attach the callback.
[in]functhe callback function, which takes the following parameters:
  • panelName The name of the panel that contains the 3d view.
  • 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::kUnknownParameter The named UI object could not be found
  • MS::kInsufficientMemory No memory available
  • MS::kFailure Error adding callback
Examples:
lensDistortionCallback/lensDistortionCallback.cpp, and viewCallbackTest/viewCallbackTest.cpp.
MCallbackId add3dViewPostRenderMsgCallback ( const MString panelName,
MMessage::MStringFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

This method registers a callback for when the 3d view is about to display it's rendered contents to the viewport.

It is called for every refresh of the view, after the scene is drawn, but before any 2d adornments are drawn.

The callback function will be passed any client data that was provided when the callback was registered.

Parameters
[in]panelNameName of panel to which to attach the callback.
[in]functhe callback function, which takes the following parameters:
  • panelName The name of the panel that contains the 3d view.
  • 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::kUnknownParameter The named UI object could not be found
  • MS::kInsufficientMemory No memory available
  • MS::kFailure Error adding callback
Examples:
gpuCache/gpuCacheShapeNode.cpp, lensDistortionCallback/lensDistortionCallback.cpp, and viewCallbackTest/viewCallbackTest.cpp.
MCallbackId add3dViewPreMultipleDrawPassMsgCallback ( const MString panelName,
MUiMessage::MStringIndexFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

This method registers a callback for when a particular 3d view's specific pass is about to be drawn when multiple drawing is enabled.

The 3D view callbacks are called in the following order:

	PreRender() callback
        PreMultipleDrawPass( 0 ) callback
			MPx3dModelView::preMultipleDrawPass( 0 ) [If available]
				Render()
			MPx3dModelView::postMultipleDrawPass( 0 ) [If available]
		PostMultipleDrawPass( 0 ) callback
        PreMultipleDrawPass( 1 ) callback
			MPx3dModelView::preMultipleDrawPass( 1 ) [If available]
				Render()
			MPx3dModelView::postMultipleDrawPass( 1 ) [If available]
		PostMultipleDrawPass( 1 ) callback
		...
    PostRender callback

The callback function will be passed any client data that was provided when the callback was registered.

Parameters
[in]panelNameName of panel to which to attach the callback.
[in]functhe callback function, which takes the following parameters:
  • panelName The name of the panel that contains the 3d view.
  • 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::kUnknownParameter The named panel could not be found
  • MS::kInsufficientMemory No memory available
  • MS::kFailure Error adding callback
Examples:
lensDistortionCallback/lensDistortionCallback.cpp.
MCallbackId add3dViewPostMultipleDrawPassMsgCallback ( const MString panelName,
MUiMessage::MStringIndexFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

This method registers a callback for when a particular 3d view's specified pass is finshed when multiple drawing is enabled.

See add3dViewPreMultipleDrawPassMsgCallback for the order in which 3D view callbacks are called.

The callback function will be passed any client data that was provided when the callback was registered.

Parameters
[in]panelNameName of panel to which to attach the callback.
[in]functhe callback function, which takes the following parameters:
  • panelName The name of the panel that contains the 3d view.
  • 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::kUnknownParameter The named panel could not be found
  • MS::kInsufficientMemory No memory available
  • MS::kFailure Error adding callback
Examples:
lensDistortionCallback/lensDistortionCallback.cpp.
MCallbackId add3dViewRendererChangedCallback ( const MString panelName,
MMessage::MThreeStringFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

This method registers a callback for when the renderer for a particular 3d view changes.

The callback function will be passed any client data that was provided when the callback was registered.

Parameters
[in]panelNameName of panel to which to attach the callback.
[in]functhe callback function, which takes the following parameters:
  • panelName The name of the panel that contains the 3d view
  • oldRenderer The name of the old renderer used to draw the 3d view
  • newRenderer The name of the new renderer used to draw the 3d view
  • 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::kUnknownParameter The named panel could not be found
  • MS::kInsufficientMemory No memory available
  • MS::kFailure Error adding callback
Examples:
viewRenderOverride/viewRenderOverride.cpp.
MCallbackId add3dViewRenderOverrideChangedCallback ( const MString panelName,
MMessage::MThreeStringFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

This method registers a callback for when the render override for a particular 3d view changes.

The callback function will be passed any client data that was provided when the callback was registered.

Parameters
[in]panelNameName of panel to which to attach the callback.
[in]functhe callback function, which takes the following parameters:
  • panelName The name of the panel that contains the 3d view
  • oldOverride The name of the old override used to draw in the 3d view
  • newOverride The name of the new override used to draw in the 3d view
  • 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::kUnknownParameter The named panel could not be found
  • MS::kInsufficientMemory No memory available
  • MS::kFailure Error adding callback
Examples:
viewRenderOverride/viewRenderOverride.cpp.
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: