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

#include <MConditionMessage.h>

Inheritance diagram for MConditionMessage:

Inheritance graph
[legend]
Collaboration diagram for MConditionMessage:

Collaboration graph
[legend]

List of all members.


Detailed Description

Condition change messages.

This class is used to register callbacks for changes to specific conditions.

The addConditionCallback method will add callback a callback for condition changed messages.

The first parameter passed to the addConditionCallback method is the name of the condition that will trigger the callback. The list of available condition names can be retrieved by calling the getConditionNames method or by using the -listConditions flag on the scriptJob command.

Callbacks that are registered for conditions will be passed a bool value as a parameter. This value indicates the new state of the condition.

The addConditionCallback 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.

The getConditionState method is used to return the current state of the specified condition.

Static Public Member Functions

static MCallbackId addConditionCallback (const MString &conditionName, MMessage::MStateFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
static MStatus getConditionNames (MStringArray &names)
static bool getConditionState (const MString &name, MStatus *ReturnStatus=NULL)


Member Function Documentation

MCallbackId MConditionMessage::addConditionCallback ( const MString conditionName,
MMessage::MStateFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
) [static]

This method registers a callback for condition changed messages.

The callback function will be passed the new state of the condition and any client data that the user wishes to pass in.

Example callback ( prints out a message when a condition changes ) :

    void userCB( bool state, void* )
    {
        if (state) {
            cout << "Condition: true" << endl;
        } else {
            cout << "Condition: false" << endl;
        }
    }

Parameters:
[in] conditionName the condition to register the callback for
[in] func the callback function
  • state the new state of the condition triggering the callback
  • clientData User defined data passed to the callback function
Parameters:
[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:
Examples:

MStatus MConditionMessage::getConditionNames ( MStringArray names  )  [static]

This method returns the list of available condition names.

Parameters:
[out] names set to the array of available condition names.
Returns:
Examples:

bool MConditionMessage::getConditionState ( const MString name,
MStatus ReturnStatus = NULL 
) [static]

This method returns the current state of a condition.

Parameters:
[in] name the name of the condition.
[out] ReturnStatus status code
Returns:
The current state of the condition.
Status Codes:
Examples:


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