class MConditionMessage

Jump to documentation

: public MMessage Condition change messages. (OpenMaya) (OpenMaya.py)

Inheritance:

MConditionMessage < MMessage

public members:

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 )

Inherited from MMessage:

public members:

static MStatus removeCallback ( MCallbackId id )
static MStatus removeCallbacks ( MCallbackIdArray &ids )
static MCallbackId currentCallbackId ( MStatus * ReturnStatus = NULL )
static MStatus nodeCallbacks ( MObject & node, MCallbackIdArray & ids )
static void setRegisteringCallableScript ()
static bool registeringCallableScript ()
static MStatus removeCallbacks ( MIntArray &ids )
static MStatus nodeCallbacks ( MObject & node, MIntArray & ids )

Documentation

Condition change messages. (OpenMaya) (OpenMaya.py)
Description

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.

Functions

MCallbackId MConditionMessage:: addConditionCallback ( const MString & conditionName, MMessage::MStateFunction func, void * clientData, MStatus * ReturnStatus )

Description

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;
        }
    }
	

Arguments

  • conditionName the condition to register the callback for
  • func the callback function
    • state the new state of the condition triggering the callback
    • clientData User defined data passed to the callback function
  • clientData User defined data that will be passed to the callback function
  • ReturnStatus status code

Return Value

  • identifier used for removing the callback.

Status Codes

  • MS::kSuccess Operation succeeded
  • MS::kUnknownParameter The named condition could not be found
  • MS::kInsufficientMemory No memory available
  • MS::kFailure Error adding callback

MStatus MConditionMessage:: getConditionNames ( MStringArray & names )

Description

This method returns the list of available condition names.

Arguments

  • names set to the array of available condition names.

Return Value

  • MS::kSuccess Operation succeeded
  • MS::kInsufficientMemory No memory available
  • MS::kFailure Error retrieving condition names

bool MConditionMessage:: getConditionState ( const MString & name, MStatus * ReturnStatus )

Description

This method returns the current state of a condition.

Arguments

  • name the name of the condition.
  • ReturnStatus status code

Return Value

  • the current state of the condition.

Status Codes

  • MS::kSuccess Operation succeeded
  • MS::kUnknownParameter The named condition could not be found
  • MS::kInsufficientMemory No memory available
  • MS::kFailure Error retrieving condition state

This class has no child classes.


Autodesk® Maya® 8.0 © 1997-2006 Autodesk, Inc. All rights reserved. doc++ Copyright