Python API 2.0 Reference
OpenMaya.MSceneMessage Class Reference
+ Inheritance diagram for OpenMaya.MSceneMessage:

Static Public Member Functions

def addCallback ()
 
def addCheckCallback ()
 
def addCheckFileCallback ()
 
def addCheckReferenceCallback ()
 
def addConnectionFailedCallback ()
 
def addReferenceCallback ()
 
def addStringArrayCallback ()
 
- Static Public Member Functions inherited from OpenMaya.MMessage
def currentCallbackId ()
 
def nodeCallbacks ()
 
def removeCallback ()
 
def removeCallbacks ()
 

Static Public Attributes

int kAfterCreateReference = 45
 
int kAfterCreateReferenceAndRecordEdits = 50
 
int kAfterExport = 11
 
int kAfterExportReference = 21
 
int kAfterFileRead = 8
 
int kAfterImport = 4
 
int kAfterImportReference = 19
 
int kAfterLoadReference = 37
 
int kAfterLoadReferenceAndRecordEdits = 48
 
int kAfterNew = 2
 
int kAfterOpen = 6
 
int kAfterPluginLoad = 41
 
int kAfterPluginUnload = 43
 
int kAfterReference = 15
 
int kAfterRemoveReference = 17
 
int kAfterSave = 13
 
int kAfterSceneReadAndRecordEdits = 9
 
int kAfterSoftwareFrameRender = 27
 
int kAfterSoftwareRender = 25
 
int kAfterUnloadReference = 23
 
int kBeforeCreateReference = 44
 
int kBeforeCreateReferenceAndRecordEdits = 49
 
int kBeforeCreateReferenceCheck = 39
 
int kBeforeExport = 10
 
int kBeforeExportCheck = 35
 
int kBeforeExportReference = 20
 
int kBeforeFileRead = 7
 
int kBeforeImport = 3
 
int kBeforeImportCheck = 34
 
int kBeforeImportReference = 18
 
int kBeforeLoadReference = 36
 
int kBeforeLoadReferenceAndRecordEdits = 47
 
int kBeforeLoadReferenceCheck = 38
 
int kBeforeNew = 1
 
int kBeforeNewCheck = 31
 
int kBeforeOpen = 5
 
int kBeforeOpenCheck = 32
 
int kBeforePluginLoad = 40
 
int kBeforePluginUnload = 42
 
int kBeforeReference = 14
 
int kBeforeReferenceCheck = 39
 
int kBeforeRemoveReference = 16
 
int kBeforeSave = 12
 
int kBeforeSaveCheck = 33
 
int kBeforeSoftwareFrameRender = 26
 
int kBeforeSoftwareRender = 24
 
int kBeforeUnloadReference = 22
 
int kExportStarted = 46
 
int kLast = 51
 
int kMayaExiting = 30
 
int kMayaInitialized = 29
 
int kSceneUpdate = 0
 
int kSoftwareRenderInterrupted = 28
 
- Static Public Attributes inherited from OpenMaya.MMessage
int kDefaultAction = 0
 
int kDoAction = 2
 
int kDoNotDoAction = 1
 

Detailed Description

Class used to register callbacks for scene related messages.

Method resolution order:
-   MSceneMessage
-   MMessage
-   builtins.object

Member Function Documentation

def OpenMaya.MSceneMessage.addCallback ( )
static
addCallback(message, function, clientData=None) -> id

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 Message constant 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
 kBeforeCreateReferenceAndRecordEdits
 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.

 * message - the Message constant that will trigger the callback
 * function - callable which will be passed the clientData object
 * clientData - user data that will be passed to the callback function
def OpenMaya.MSceneMessage.addCheckCallback ( )
static
addCheckCallback(message, function, clientData=None) -> id

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.

Callbacks can be added to the following messages with this function:
 kBeforeNewCheck
 kBeforeImportCheck
 kBeforeOpenCheck
 kBeforeExportCheck
 kBeforeSaveCheck
 kBeforeCreateReferenceCheck
 kBeforeLoadReferenceCheck

 * message - the scene message that will trigger the callback
 * function - callable which will be passed the clientData object,
   return False to abort the current operation.
 * clientData - user data that will be passed to the callback function

 * return: Identifier used for removing the callback.
def OpenMaya.MSceneMessage.addCheckFileCallback ( )
static
addCheckFileCallback(message, function, clientData=None) -> id

This function adds a new callback for the specified scene message. This
callback has the option to abort the current operation by returning
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.

Callbacks can be added to the following messages with this function:
 kBeforeImportCheck
 kBeforeOpenCheck
 kBeforeExportCheck
 kBeforeCreateReferenceCheck
 kBeforeLoadReferenceCheck

 * message - the scene message that will trigger the callback
 * function - callable which will be passed a MFileObject indicating the
   file object 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, and the clientData object.
   return False to abort the current operation.
 * clientData - User defined data passed to the callback function

 * return: Identifier used for removing the callback.
def OpenMaya.MSceneMessage.addCheckReferenceCallback ( )
static
addCheckReferenceCallback(message, function, clientData=None) -> id

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.

Callbacks can be added to the following Message constant with this function:
 BeforeLoadReferenceCheck

 * message - the scene Message constant that will trigger the callback
 * function - callable which will be passed a MObject indicating the
   reference node, a MFileObject indicating the resolved file path of the
   referenced file, and the clientData object
   return False to abort the current operation
 * clientData - User defined data passed to the callback function

 * return: Identifier used for removing the callback.
def OpenMaya.MSceneMessage.addConnectionFailedCallback ( )
static
addConnectionFailedCallback(function, clientData=None) -> id

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

 * function - callable which will be passed a MPlug indicating the
   source plug of the connection (or None if it could not be found),
   a MPlug indicating destination plug of the connection (or None if
   it could not be found), a string containing the name used to look up
   the source plug, a string containing the name used to look up the
   destination plug and the clientData object.
 * clientData - User defined data passed to the callback function

 * return: Identifier used for removing the callback.
def OpenMaya.MSceneMessage.addReferenceCallback ( )
static
addReferenceCallback(message, function, clientData=None) -> id

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

 * message - the scene Message constant that will trigger the callback
 * function - callable which will be passed a MObject indicating the
   reference node, a MFileObject indicating he resolved file path of the 
   referenced file and the clientData object.
 * clientData - User defined data passed to the callback function

 * return: Identifier used for removing the callback.
def OpenMaya.MSceneMessage.addStringArrayCallback ( )
static
addStringArrayCallback(message, function, clientData=None) -> id

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

The Message constants 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.

 * message - the scene Message constant that will trigger the callback
 * function - callable which will be passed a list of strings and the
   clientData object.
 * clientData - User defined data passed to the callback function

 * return: Identifier used for removing the callback.