C++ API Reference
MSceneMessage Class Reference

Scene messages. More...

#include <MSceneMessage.h>

+ Inheritance diagram for MSceneMessage:

Public Types

enum  Message {
  kSceneUpdate, kBeforeNew, kAfterNew, kBeforeImport,
  kAfterImport, kBeforeOpen, kAfterOpen, kBeforeFileRead,
  kAfterFileRead, kAfterSceneReadAndRecordEdits, kBeforeExport, kAfterExport,
  kBeforeSave, kAfterSave, kBeforeReference, kAfterReference,
  kBeforeRemoveReference, kAfterRemoveReference, kBeforeImportReference, kAfterImportReference,
  kBeforeExportReference, kAfterExportReference, kBeforeUnloadReference, kAfterUnloadReference,
  kBeforeSoftwareRender, kAfterSoftwareRender, kBeforeSoftwareFrameRender, kAfterSoftwareFrameRender,
  kSoftwareRenderInterrupted, kMayaInitialized, kMayaExiting, kBeforeNewCheck,
  kBeforeOpenCheck, kBeforeSaveCheck, kBeforeImportCheck, kBeforeExportCheck,
  kBeforeLoadReference, kAfterLoadReference, kBeforeLoadReferenceCheck, kBeforeReferenceCheck,
  kBeforeCreateReferenceCheck = kBeforeReferenceCheck, kBeforePluginLoad, kAfterPluginLoad, kBeforePluginUnload,
  kAfterPluginUnload, kBeforeCreateReference, kAfterCreateReference, kExportStarted,
  kBeforeLoadReferenceAndRecordEdits, kAfterLoadReferenceAndRecordEdits, kBeforeCreateReferenceAndRecordEdits, kAfterCreateReferenceAndRecordEdits,
  kLast
}
 Events to which messages can be attached. 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 addCallback (Message msg, MMessage::MBasicFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 Adds a new callback for the specified scene message. More...
 
static MCallbackId addCheckCallback (Message msg, MMessage::MCheckFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 This function adds a new callback for the specified scene message. More...
 
static MCallbackId addCheckFileCallback (Message msg, MMessage::MCheckFileFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 This function adds a new callback for the specified scene message. More...
 
static MCallbackId addStringArrayCallback (Message msg, MMessage::MStringArrayFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 Adds a new callback which takes a string array argument, in addition to the usual clientData. More...
 
static MCallbackId addReferenceCallback (Message msg, MMessage::MObjectFileFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 This function adds a new callback for the specified scene message. More...
 
static MCallbackId addCheckReferenceCallback (Message msg, MMessage::MCheckObjectFileFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 This function adds a new callback for the specified scene message. More...
 
static MCallbackId addConnectionFailedCallback (MMessage::MConnFailFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 This method registers a callback that is called when a connection was unable to be made. More...
 
static MCallbackId addNamespaceRenamedCallback (MMessage::MTwoStringFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 This method registers a callback that is called when a namespace is renamed. More...
 
static const char * className ()
 Returns the name of this class. More...
 
static MCallbackId addCallback (Message, void(*func)(bool *retCode, void *clientData), void *clientData=NULL, MStatus *ReturnStatus=NULL)
 Deprecated in 2019.0 More...
 
static MCallbackId addCallback (Message, void(*func)(bool *retCode, MFileObject &file, void *clientData), void *clientData=NULL, MStatus *ReturnStatus=NULL)
 Deprecated in 2019.0 More...
 
static MCallbackId addCallback (Message, void(*func)(const MStringArray &, void *), void *clientData, MStatus *ReturnStatus)
 Deprecated in 2019.0 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 ()
 Introduced in 2019.0 More...
 
static void setCallableInfo (MPluginCallableInfo *info)
 Introduced in 2020.0 More...
 
static MPluginCallableInfogetCallableInfo ()
 Introduced in 2020.0 More...
 
static MPluginCallableInfostealCallableInfo ()
 Introduced in 2020.0 More...
 
static const char * className ()
 Returns the name of this class. More...
 
static MStatus removeCallbacks (MIntArray &ids)
 Deprecated in 2019.0 More...
 
static MStatus nodeCallbacks (MObject &node, MIntArray &ids)
 Deprecated in 2019.0 More...
 

Detailed Description

Scene messages.

This class is used to register callbacks for scene related messages.

The addCallback method registers a function that will be executed whenever the specified message occurs. An id is returned and 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 Enumeration Documentation

enum Message

Events to which messages can be attached.

Enumerator
kSceneUpdate 

Called after any operation that changes which files are loaded.

kBeforeNew 

Called before a File > New operation.

kAfterNew 

Called after a File > New operation.

kBeforeImport 

Called before a File > Import operation.

kAfterImport 

Called after a File > Import operation.

kBeforeOpen 

Called before a File > Open operation.

kAfterOpen 

Called after a File > Open operation.

kBeforeFileRead 

Called immediately before any file read operation (open, import or reference) and while reading state (MFileIO::isReadingFile) is true.

kAfterFileRead 

Called immediately after any file read operation (open, import or reference) and while reading state (MFileIO::isReadingFile) is true.

kAfterSceneReadAndRecordEdits 

Call once after any file operation (open, import or reference) with reference edits recorded during the execution of the callback Note, isReadingFile is false during this callback.

kBeforeExport 

Called before a File > Export operation.

kAfterExport 

Called after a File > Export operation.

kBeforeSave 

Called before a File > Save (or SaveAs) operation.

kAfterSave 

Called after a File > Save (or SaveAs) operation.

kBeforeReference 

Called before a File > Reference operation. Deprecated. Use kBeforeCreateReference/kBeforeLoadReference.

kAfterReference 

Called after a File > Reference operation. Deprecated. Use kAfterCreateReference/kAfterLoadReference.

kBeforeRemoveReference 

Called before a File > RemoveReference operation.

kAfterRemoveReference 

Called after a File > RemoveReference operation.

kBeforeImportReference 

Called before a File > ImportReference operation.

kAfterImportReference 

Called after a File > ImportReference operation.

kBeforeExportReference 

Called before a File > ExportReference operation.

kAfterExportReference 

Called after a File > ExportReference operation.

kBeforeUnloadReference 

Called before a File > UnloadReference operation.

kAfterUnloadReference 

Called after a File > UnloadReference operation.

kBeforeSoftwareRender 

Called before a Software Render begins.

kAfterSoftwareRender 

Called after a Software Render ends.

kBeforeSoftwareFrameRender 

Called before each frame of a Software Render.

kAfterSoftwareFrameRender 

Called after each frame of a Software Render.

kSoftwareRenderInterrupted 

Called when an interactive render is interrupted by the user.

kMayaInitialized 

Called on interactive or batch startup after initialization.

kMayaExiting 

Called just before Maya exits.

kBeforeNewCheck 

Called prior to File > New operation, allows user to cancel action.

kBeforeOpenCheck 

Called prior to File > Open operation, allows user to cancel action.

kBeforeSaveCheck 

Called prior to File > Save operation, allows user to cancel action.

kBeforeImportCheck 

Called prior to File > Import operation, allows user to cancel action.

kBeforeExportCheck 

Called prior to File > Export operation, allows user to cancel action.

kBeforeLoadReference 

Called before a File > LoadReference operation.

kAfterLoadReference 

Called after a File > LoadReference operation.

kBeforeLoadReferenceCheck 

Called before a File > LoadReference operation, allows user to cancel action.

kBeforeReferenceCheck 

Called prior to a File > CreateReference operation, allows user to cancel action. Deprecated. Use kBeforeCreateReferenceCheck.

kBeforeCreateReferenceCheck 

Called prior to a File > CreateReference operation, allows user to cancel action.

kBeforePluginLoad 

Called prior to a plugin being loaded.

kAfterPluginLoad 

Called after a plugin is loaded.

kBeforePluginUnload 

Called prior to a plugin being unloaded.

kAfterPluginUnload 

Called after a plugin is unloaded.

kBeforeCreateReference 

Called before a File > CreateReference operation.

kAfterCreateReference 

Called after a File > CreateReference operation.

kExportStarted 

Called at the start of a File > Export operation, after the export file has become the active file.

kBeforeLoadReferenceAndRecordEdits 

Same as kBeforeLoadReference except reference edits are recorded during the execution of the callback.

kAfterLoadReferenceAndRecordEdits 

Same as kAfterLoadReference except reference edits are recorded during the execution of the callback.

kBeforeCreateReferenceAndRecordEdits 

Same as kBeforeCreateReference except reference edits are recorded during the execution of the callback.

kAfterCreateReferenceAndRecordEdits 

Same as kAfterCreateReference except reference edits are recorded during the execution of the callback.

kLast 

Last value of the enum.

Member Function Documentation

OPENMAYA_MAJOR_NAMESPACE_OPEN MCallbackId addCallback ( MSceneMessage::Message  msg,
MMessage::MBasicFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

Adds a new callback for the specified scene message.

If a 'before' message is sent, the corresponding 'after' message will be as well.

Callbacks can be added to the following messages with this function:

  • kSceneUpdate
  • kBeforeNew
  • kAfterNew
  • kBeforeImport
  • kAfterImport
  • kBeforeOpen
  • kAfterOpen
  • kBeforeFileRead
  • kAfterFileRead
  • kAfterSceneReadAndRecordEdits
  • kBeforeExport
  • kExportStarted
  • kAfterExport
  • kBeforeSave
  • kAfterSave
  • kBeforeCreateReference
  • kBeforeCreateReferenceAndRecordEdits
  • kAfterCreateReference
  • kAfterCreateReferenceAndRecordEdits
  • kBeforeRemoveReference
  • kAfterRemoveReference
  • kBeforeImportReference
  • kAfterImportReference
  • kBeforeExportReference
  • kAfterExportReference
  • kBeforeUnloadReference
  • kAfterUnloadReference
  • kBeforeLoadReference
  • kBeforeLoadReferenceAndRecordEdits
  • kAfterLoadReference
  • kAfterLoadReferenceAndRecordEdits
  • kBeforeSoftwareRender
  • kAfterSoftwareRender
  • kBeforeSoftwareFrameRender
  • kAfterSoftwareFrameRender
  • kSoftwareRenderInterrupted
  • kMayaInitialized
  • kMayaExiting

Note that for referencing, the creation of the reference (i.e. creation of the reference node and associated structures) is separate from the loading of the reference itself (i.e. read the nodes from file).

The kBeforeCreateReference message will be sent when a reference is created. So it will happen for both loaded and unloaded references. But the kBeforeLoadReference message will only be sent when the file is read from disk.

When opening a file with a loaded reference, the callback order is as follows,

  • kBeforeCreateReference
  • kBeforeCreateReferenceAndRecordEdits
  • kAfterCreateReference
  • kAfterCreateReferenceAndRecordEdits
  • kBeforeLoadReference
  • kBeforeLoadReferenceAndRecordEdits
  • kAfterLoadReference
  • kAfterLoadReferenceAndRecordEdits

By default, edits to referenced objects will not be recorded during the execution of file I/O callbacks. A specific set of callbacks are provided that will enable the recording of reference edits during their execution as follows,

  • kAfterSceneReadAndRecordEdits
  • kBeforeCreateReferenceAndRecordEdits
  • kAfterCreateReferenceAndRecordEdits
  • kBeforeLoadReferenceAndRecordEdits
  • kAfterLoadReferenceAndRecordEdits

The kExportStarted callback is sent after the kBeforeExport callback, once Maya has actually started to process the exported data. One important difference between the two callbacks is that the fileInfo command affects the exported scene when used in the kExportStarted callback, but affects the current scene in memory when used in the kBeforeExport callback.

Parameters
[in]msgthe scene message that will trigger the callback
[in]functhe callback function
  • clientData User defined data passed to the callback function
[in]clientDatauser 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:
autoLoader/autoLoader.cpp, cgFx/pluginMain.cpp, dx11Shader/dx11Shader.cpp, dx11Shader/dx11ShaderCompileHelper.cpp, fileIOMsgCmd/fileIOMsgCmd.cpp, glslShader/GLSLShader.cpp, gpuCache/gpuCacheSubSceneOverride.cpp, gpuCache/gpuCacheVBOProxy.cpp, hlslShader/hlslShader.cpp, and ik2Bsolver/ik2Bsolver.cpp.
MCallbackId addCheckCallback ( MSceneMessage::Message  msg,
MMessage::MCheckFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

This function adds a new callback for the specified scene message.

The callback will have the ability to abort the current operation by returning false through its 'retCode' parameter.

NOTE: The check message is sent out before the equivalent non-check type. As a result, if the check message aborts the operation, the equivalent non-check message type will not be sent.

Callbacks can be added to the following messages with this function:

  • kBeforeNewCheck
  • kBeforeImportCheck
  • kBeforeOpenCheck
  • kBeforeExportCheck
  • kBeforeSaveCheck
  • kBeforeCreateReferenceCheck
  • kBeforeLoadReferenceCheck
Parameters
[in]msgthe scene message that will trigger the callback
[in]functhe callback function
  • retCode boolean passed in to the callback function. In case of error, the callback function should set this to false.
  • clientData User defined data passed to the callback function
[in]clientDatauser 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 addCheckFileCallback ( MSceneMessage::Message  msg,
MMessage::MCheckFileFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

This function adds a new callback for the specified scene message.

This callback has the option to abort the current operation by setting the retCode parameter to false. The file parameter stores the target file for the current file IO operation, by modifying this file parameter the target file will be changed as well.

NOTE: The check message is sent out before the equivalent non-check type. As a result, if the check message aborts the operation, the equivalent non-check message type will not be sent.

Callbacks can be added to the following messages with this function:

  • kBeforeImportCheck
  • kBeforeOpenCheck
  • kBeforeExportCheck
  • kBeforeCreateReferenceCheck
  • kBeforeLoadReferenceCheck
Parameters
[in]msgthe scene message that will trigger the callback
[in]functhe callback function
  • retCode boolean passed in to the callback function. In case of error, the callback function should set this to false.
  • file MFileObject passed in to the callback function. This is the MFileObject that will be acted on by the current file IO operation, any modifications to it will be passed back to Maya and change the file being acted on.
  • clientData User defined data passed to the callback function
[in]clientDatauser 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 addStringArrayCallback ( MSceneMessage::Message  msg,
MMessage::MStringArrayFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

Adds a new callback which takes a string array argument, in addition to the usual clientData.

The messages which can be used with this method and the contents of the string array passed to their callbacks are as follows:

  • kBeforePluginLoad - path to plug-in file
  • kAfterPluginLoad - path to plug-in file, name of plug-in
  • kBeforePluginUnload - name of plug-in
  • kAfterPluginUnload - name of plug-in, path to plug-in file

To allow for future expansion callbacks should not rely on the number of array elements being exactly as given above. While there will not be fewer elements than given above, there may in future be more.

Parameters
[in]msgthe scene message that will trigger the callback
[in]functhe callback function
  • strs immutable array of strings
  • clientData User defined data passed to the callback function
[in]clientDatauser 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:
pluginCallbacks/pluginCallbacks.cpp.
MCallbackId addReferenceCallback ( MSceneMessage::Message  msg,
MMessage::MObjectFileFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

This function adds a new callback for the specified scene message.

Callbacks can be added to the following messages with this function:

  • kBeforeRemoveReference
  • kBeforeImportReference
  • kBeforeUnloadReference
  • kAfterUnloadReference
  • kBeforeLoadReference
  • kAfterLoadReference
  • kAfterCreateReference
  • kAfterCreateReferenceAndRecordEdits
  • kBeforeLoadReferenceAndRecordEdits
  • kAfterLoadReferenceAndRecordEdits
Parameters
[in]msgthe scene message that will trigger the callback
[in]functhe callback function
  • referenceNode The reference node.
  • file The resolved file path of the referenced file.
  • clientData User defined data passed to the callback function
[in]clientDatauser 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 addCheckReferenceCallback ( MSceneMessage::Message  msg,
MMessage::MCheckObjectFileFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

This function adds a new callback for the specified scene message.

The callback will have the ability to abort the current operation by returning false through its 'retCode' parameter.

NOTE: The check message is sent out before the equivalent non-check type. As a result, if the check message aborts the operation, the equivalent non-check message type will not be sent.

Callbacks can be added to the following messages with this function:

  • kBeforeLoadReferenceCheck
Parameters
[in]msgthe scene message that will trigger the callback
[in]functhe callback function
  • retCode boolean passed in to the callback function. In case of error, the callback function should set this to false.
  • referenceNode The reference node.
  • file The resolved file path of the referenced file.
  • clientData User defined data passed to the callback function
[in]clientDatauser 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 addConnectionFailedCallback ( MMessage::MConnFailFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

This method registers a callback that is called when a connection was unable to be made.

Currently, the callback is only triggered during the reading of files (.ma or .mb) or of edits files (.editMA or .editMB files created by Maya's offline file support). The most common reasons why a connection would fail are:

  • inability to find the specified node or attribute names, or
  • a conflicting existing connection
Parameters
[in]functhe callback function
  • srcPlug Source plug of the connection (or a NULL plug if it could not be found)
  • destPlug Destination plug of the connection (or a NULL plug if it could not be found)
  • srcPlugName Name used to look up the source plug.
  • dstPlugName Name used to look up the destination plug.
  • clientData User defined data passed to the callback function
[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
Examples:
atomImportExport/atomImportExport.cpp.
MCallbackId addNamespaceRenamedCallback ( MMessage::MTwoStringFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

This method registers a callback that is called when a namespace is renamed.

Parameters
[in]functhe callback function
  • nsNew New name of namespace that was changed
  • nsOld Old name of namespace that was changed
  • clientData User defined data passed to the callback function
[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
const char * className ( )
static

Returns the name of this class.

Returns
The name of this class.
MCallbackId addCallback ( MSceneMessage::Message  msg,
void(*)(bool *retCode, void *clientData)  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

Deprecated in 2019.0

Not available in Python.

Deprecated:
Use the MSceneMessage::addCheckCallback() method instead.
2019.0:
Deprecated in this version.
Parameters
[in]msg
[in]func
[in]clientData
[out]ReturnStatus
MCallbackId addCallback ( MSceneMessage::Message  msg,
void(*)(bool *retCode, MFileObject &file, void *clientData)  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

Deprecated in 2019.0

Not available in Python.

Deprecated:
Use the MSceneMessage::addCheckFileCallback() method instead.
2019.0:
Deprecated in this version.
Parameters
[in]msg
[in]func
[in]clientData
[out]ReturnStatus
MCallbackId addCallback ( MSceneMessage::Message  msg,
void(*)(const MStringArray &, void *)  func,
void *  clientData,
MStatus ReturnStatus 
)
static

Deprecated in 2019.0

Not available in Python.

Deprecated:
Use the MSceneMessage::addStringArrayCallback() method instead.
2019.0:
Deprecated in this version.
Parameters
[in]msg
[in]func
[in]clientData
[out]ReturnStatus

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