MCommandMessage Class Reference
[OpenMaya - API module for common classes]

#include <MCommandMessage.h>
Inheritance diagram for MCommandMessage:
Inheritance graph
[legend]
Collaboration diagram for MCommandMessage:
Collaboration graph
[legend]

List of all members.


Detailed Description

Helper class to handle MEL output.

This class is used to register for a callback for when certain MEL command related messages are generated.

The add callback 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.

Note:
Setting up a callback using the addCommandCallback() method may degrade the performance of Maya since the installed callback will be invoked repeatedly as MEL operations are processed.

Public Types

enum   MessageType {
   kHistory, kDisplay, kInfo, kWarning,
   kError, kResult, kStackTrace
}
  Types of output messages. More...
typedef void(*  MMessageFunction )(const MString &message, MCommandMessage::MessageType messageType, void *clientData)
  Pointer to a message function.
typedef void(*  MMessageFilterFunction )(const MString &message, MCommandMessage::MessageType messageType, bool &filterOutput, void *clientData)
  Pointer to a message filter function.

Static Public Member Functions

static MCallbackId  addCommandCallback (MMessage::MStringFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
static MCallbackId  addCommandOutputCallback (MCommandMessage::MMessageFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
static MCallbackId  addCommandOutputFilterCallback (MCommandMessage::MMessageFilterFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)

Member Typedef Documentation

typedef void(* MCommandMessage::MMessageFunction)(const MString &message, MCommandMessage::MessageType messageType, void *clientData)

Pointer to a message function.

Parameters:
[in]  message  The command that was executed.
[in]  messageType  The type of message.
[in,out]  clientData  User defined data passed to the callback function.

typedef void(* MCommandMessage::MMessageFilterFunction)(const MString &message, MCommandMessage::MessageType messageType, bool &filterOutput, void *clientData)

Pointer to a message filter function.

Parameters:
[in]  message  The command that was executed.
[in]  messageType  The type of message.
[out]  filter  Bool that causes Maya to filter this message if set to true.
[in,out]  clientData  User defined data passed to the callback function.

Member Enumeration Documentation

Types of output messages.

Enumerator:
kHistory  Command history.
kDisplay  String to display unmodified.
kInfo  General information.
kWarning  Warning message.
kError  Error message.
kResult  Result from a command execution in the command window.
kStackTrace  Stack trace.

Member Function Documentation

MCallbackId MCommandMessage::addCommandCallback ( MMessage::MStringFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL  
) [static]

This method registers a callback for command messages that are issued every time a MEL command is executed. It is only called when actual commands are executed and not when scripts are executed.

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

NOTE: Setting up a callback using this method will degrade the performance of Maya since the installed callback will be invoked repeatedly as MEL operations are processed.

Parameters:
[in]  func  The callback function.
[in]  clientData  User defined data that will be passed to the callback function.
[out]  ReturnStatus  Status code.
Returns:
Identifier used for removing the callback.
Status Codes:

MCallbackId MCommandMessage::addCommandOutputCallback ( MCommandMessage::MMessageFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL  
) [static]

This method registers a callback for whenever MEL commands generate output such as that which is printed into the command window.

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

Parameters:
[in]  func  The callback function.
[in]  clientData  User defined data that will be passed to the callback function.
[out]  ReturnStatus  Status code.
Returns:
Identifier used for removing the callback.
Status Codes:

MCallbackId MCommandMessage::addCommandOutputFilterCallback ( MCommandMessage::MMessageFilterFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL  
) [static]

This method registers a callback for whenever MEL commands generate output such as that which is printed into the command window.

This callback includes a boolean filter option which allows the callback to prevent the output of the message to the script editor and command line output. Setting the 'filterOutput' parameter to true, inside your callback will filter the output from the script editor and command line output.

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

Parameters:
[in]  func  The callback function.
[in]  clientData  User defined data that will be passed to the callback function.
[out]  ReturnStatus  Status code.
Returns:
Identifier used for removing the callback.
Status Codes:

Autodesk® Maya® 2011 © 1997-2010 Autodesk, Inc. All rights reserved. Generated with doxygen 1.5.6