#include
<MConditionMessage.h>
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) |
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; } }
[in] | conditionName | the condition to register the callback for |
[in] | func | the callback function |
[in] | clientData | User defined data that will be passed to the callback function |
[out] | ReturnStatus | status code |
MStatus MConditionMessage::getConditionNames | ( | MStringArray & | names | ) | [static] |
This method returns the list of available condition names.
[out] | names | set to the array of available condition names. |
bool MConditionMessage::getConditionState | ( | const MString & | name, | |
MStatus * | ReturnStatus =
NULL |
|||
) | [static] |
This method returns the current state of a condition.
[in] | name | the name of the condition. |
[out] | ReturnStatus | status code |
Autodesk® Maya® 2011 © 1997-2010 Autodesk, Inc. All rights reserved. | Generated with 1.5.6 |