MPolyMessage Class Reference

#include <MPolyMessage.h>

Class Description

Polygon component id change messages.

This class is used to register callbacks for poly component id modification messages.

There is 1 add callback method which will add callbacks for the following messages:

  • vertex component id modified
  • edge component id modified
  • face component id modified

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.

+ Inheritance diagram for MPolyMessage:

Public Types

enum  { kVertexIndex = 0, kEdgeIndex = 1, kFaceIndex = 2, kLastErrorIndex = 3 }
 Values passed in addPolyComponentIdChangeCallback's "wantIdModifications" array to indicate which component id changes should trigger the callback. More...
 
enum  MessageType { kUVSetAdded, kUVSetDeleted, kCurrentUVSetChanged }
 Types of UV set change messages. More...
 
typedef void(* MNodeStringTypeFunction) (MObject &node, const MString &name, MPolyMessage::MessageType type, void *clientData)
 Pointer to a callback function which takes a node, a string and message type. More...
 
- Public Types inherited from MMessage
enum  Action { kDefaultAction, kDoNotDoAction, kDoAction }
 Callback result action codes. More...
 
typedef void(* MBasicFunction) (void *clientData)
 Pointer to a basic callback function. More...
 
typedef void(* MElapsedTimeFunction) (float elapsedTime, float lastTime, void *clientData)
 Pointer to an elapsed time callback function. More...
 
typedef void(* MCheckFunction) (bool *retCode, void *clientData)
 Pointer to callback function which returns a true/false result. More...
 
typedef void(* MCheckFileFunction) (bool *retCode, MFileObject &file, void *clientData)
 Pointer to a callback function which takes a file object and returns a result. More...
 
typedef void(* MCheckPlugFunction) (bool *retCode, MPlug &plug, void *clientData)
 Pointer to a callback function which takes a plug and returns a result. More...
 
typedef void(* MComponentFunction) (MUintArray componentIds[], unsigned int count, void *clientData)
 Pointer to a callback function which takes an array of component ids. More...
 
typedef void(* MNodeFunction) (MObject &node, void *clientData)
 Pointer to a callback function which takes a dependency node. More...
 
typedef void(* MStringFunction) (const MString &str, void *clientData)
 Pointer to callback function which takes a string. More...
 
typedef void(* MTwoStringFunction) (const MString &str1, const MString &str2, void *clientData)
 Pointer to a callback function which takes two strings. More...
 
typedef void(* MThreeStringFunction) (const MString &str1, const MString &str2, const MString &str3, void *clientData)
 Pointer to a callback function which takes three strings. More...
 
typedef void(* MStringIntBoolIntFunction) (const MString &str, unsigned int index, bool flag, unsigned int type, void *clientData)
 Pointer to callback function which takes a string, an index, a flag and a type. More...
 
typedef void(* MStringIndexFunction) (const MString &, unsigned int index, void *clientData)
 Pointer to callback function which takes a string and index. More...
 
typedef void(* MNodeStringBoolFunction) (MObject &node, const MString &, bool, void *clientData)
 Pointer to a callback function which takes a node, a string and a boolean. More...
 
typedef void(* MStateFunction) (bool state, void *clientData)
 Pointer to a callback function which takes a boolean state. More...
 
typedef void(* MTimeFunction) (MTime &time, void *clientData)
 Pointer to callback function which takes a time. More...
 
typedef void(* MPlugFunction) (MPlug &srcPlug, MPlug &destPlug, bool made, void *clientData)
 Pointer to plug connection callback function. More...
 
typedef void(* MNodePlugFunction) (MObject &node, MPlug &plug, void *clientData)
 Pointer to a callback function which takes a dependency node and a plug. More...
 
typedef void(* MNodeStringFunction) (MObject &node, const MString &str, void *clientData)
 Pointer to a callback function which takes a dependency node and a string. More...
 
typedef void(* MParentChildFunction) (MDagPath &child, MDagPath &parent, void *clientData)
 Pointer to to a callback function which takes two DAG nodes in a parent/child relationship. More...
 
typedef void(* MModifierFunction) (MDGModifier &modifier, void *clientData)
 Pointer to a callback function which takes a DG modifier. More...
 
typedef void(* MStringArrayFunction) (const MStringArray &strs, void *clientData)
 Pointer to a callback function which takes a string array. More...
 
typedef void(* MNodeModifierFunction) (MObject &node, MDGModifier &modifier, void *clientData)
 Pointer to a callback function which takes a dependency node and a DG modifier. More...
 
typedef void(* MObjArray) (MObjectArray &objects, void *clientData)
 Pointer to a callback function which takes an array of objects. More...
 
typedef void(* MNodeObjArray) (MObject &node, MObjectArray &objects, void *clientData)
 Pointer to a callback function which takes a dependency node and an array of objects. More...
 
typedef void(* MStringNode) (const MString &str, MObject &node, void *clientData)
 Pointer to a callback function which takes a string and a dependency node. More...
 
typedef void(* MCameraLayerFunction) (MObject &cameraSetNode, unsigned int multiIndex, bool added, void *clientData)
 Pointer to a callback function which takes a dependency node, an unsigned integer, and a boolean value. More...
 
typedef void(* MCameraLayerCameraFunction) (MObject &cameraSetNode, unsigned int multiIndex, MObject &oldCamera, MObject &newCamera, void *clientData)
 Pointer to a callback function which takes a dependency node, an unsigned integer, and two camera transform nodes. More...
 
typedef void(* MConnFailFunction) (MPlug &srcPlug, MPlug &destPlug, const MString &srcPlugName, const MString &dstPlugName, void *clientData)
 Pointer to connection-failed callback function. More...
 
typedef void(* MPlugsDGModFunction) (MPlugArray &plugs, MDGModifier &modifier, void *clientData)
 Pointer to a callback function which takes an array of MPlugs and an MDGModifier. More...
 
typedef void(* MNodeUuidFunction) (MObject &node, const MUuid &uuid, void *clientData)
 Pointer to a callback function which takes a dependency node and a UUID. More...
 
typedef Action(* MCheckNodeUuidFunction) (bool doAction, MObject &node, MUuid &uuid, void *clientData)
 Pointer to a callback function which takes a dependency node and a UUID, and returns a result. More...
 
typedef void(* MObjectFileFunction) (const MObject &object, const MFileObject &file, void *clientData)
 Pointer to a callback function which takes an object and a file object. More...
 
typedef void(* MCheckObjectFileFunction) (bool *retCode, const MObject &referenceNode, MFileObject &file, void *clientData)
 Pointer to a callback function which takes an object and a file object and returns a result. More...
 
typedef void(* MRenderTileFunction) (int originX, int originY, int tileMaxX, int tileMaxY, const void *tileData)
 Pointer to a callback function which receives origin, size and image data. More...
 

Static Public Member Functions

static MCallbackId addPolyComponentIdChangedCallback (MObject &node, bool wantIdModifications[], unsigned int count, MMessage::MComponentFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 This method registers a callback that should be called whenever a poly component id is modified. More...
 
static MCallbackId addPolyTopologyChangedCallback (MObject &node, MMessage::MNodeFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 This method registers a callback that will be called when a node impacting the topology of a meshShape is modified. More...
 
static MCallbackId addUVSetChangedCallback (MObject &node, MPolyMessage::MNodeStringTypeFunction func, void *clientData=NULL, MStatus *ReturnStatus=NULL)
 This method registers a callback that will be called when UV set is modified. More...
 
static unsigned int deletedId (void)
 This method returns a constant which is to be used to determine if a component id has been deleted. More...
 
static const char * className ()
 Returns the name of this class. More...
 
- Static Public Member Functions inherited from MMessage
static MStatus removeCallback (MCallbackId id)
 Remove the specified callback from maya. More...
 
static MStatus removeCallbacks (MCallbackIdArray &ids)
 Remove all of the specified callbacks from maya. More...
 
static MCallbackId currentCallbackId (MStatus *ReturnStatus=NULL)
 Return the callback ID of the currently executing callback. More...
 
static MStatus nodeCallbacks (MObject &node, MCallbackIdArray &ids)
 Returns a list of callback IDs associated registered to a given node. More...
 
static void setRegisteringCallableScript ()
 Mark this MMessage object as one that will be passed callbacks defined in script.
 
static bool registeringCallableScript ()
 Return true if this MMessage object has its callbacks defined in script.
 
static const char * className ()
 Returns the name of this class. More...
 
static MStatus removeCallbacks (MIntArray &ids)
 This method is obsolete. This method is not available in Python. More...
 
static MStatus nodeCallbacks (MObject &node, MIntArray &ids)
 This method is obsolete. More...
 

Member Typedef Documentation

typedef void(* MNodeStringTypeFunction) (MObject &node, const MString &name, MPolyMessage::MessageType type, void *clientData)

Pointer to a callback function which takes a node, a string and message type.

Parameters
[in,out]nodeThe node for which this callback was registered.
[in]nameThe meaning depends upon the specific message type for which the callback was registered.
[in]typeThe type of message.
[in,out]clientDataPointer to user-defined data supplied when the callback was registered.

Member Enumeration Documentation

anonymous enum

Values passed in addPolyComponentIdChangeCallback's "wantIdModifications" array to indicate which component id changes should trigger the callback.

Enumerator
kVertexIndex 

vertex component id changed

kEdgeIndex 

edge component id changed

kFaceIndex 

face component id changed

kLastErrorIndex 

 

Types of UV set change messages.

Enumerator
kUVSetAdded 

new UV set added

kUVSetDeleted 

UV set deleted.

kCurrentUVSetChanged 

current UV set changed

Member Function Documentation

OPENMAYA_MAJOR_NAMESPACE_OPEN MCallbackId addPolyComponentIdChangedCallback ( MObject node,
bool  wantIdModifications[],
unsigned int  count,
MMessage::MComponentFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

This method registers a callback that should be called whenever a poly component id is modified.

Currently, there are some cases where the component ids for a polygonal mesh can be modified without generating a callback or without generating a correct mapping. These cases are outlined below.

  • Polygonal mesh has construction history enabled, and there is more than one topology changing operation in the history. In this case, the callback is only called when the component ID mapping changes for the most recent operation, and performs the mapping with respect to the input and output meshes for this operation node.
  • Polygonal mesh has construction history enabled, and the most recent topology changing operation is no longer the most recent operation. In this case, no id remapping callbacks will be invoked when the attributes on the operation node are changed in the history.
  • When undo is used to revert a topology changing operation, the callback will not be invoked. The MEventMessage class can be used to get notification when undo is performed.

Component id mapping should always work correctly when construction history is off. It should also work correctly when construction history is on and only the most recent operation is permitted to be adjusted (eg. changing the distance parameter for a merge vertex node, when merge vertices was the most recent operation.) In either case, undo will not produce a poly message callback.

Parameters
[in]nodethe node callback function should listen to
[in]wantIdModificationsarray of booleans specifying what arrays should be provided to the callback function when it is invoked. The entries in this array are kVertexIndex, kEdgeIndex, kFaceIndex for receiving vertex, edge, and face data in the callback respectively.
[in]countthe size of the array wantIdModifications
[in]functhe callback function
  • componentIds an array of component id mappings
  • count the size of the array componentIds
  • clientData User defined data passed to the callback function
Parameters
[in]clientDataUser defined data passed to the callback function
[out]ReturnStatusstatus code
Returns
Identifier used for removing the callback.
Status Codes:
  • MS::kSuccess Operation succeeded
  • MS::kInsufficientMemory No memory available
  • MS::kFailure Error adding callback, at least one of the want*IdModifications parameters must be true
+ Examples:
MCallbackId addPolyTopologyChangedCallback ( MObject node,
MMessage::MNodeFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

This method registers a callback that will be called when a node impacting the topology of a meshShape is modified.

Because the callback is invoked before the mesh has evaluated, the new topology data cannot be queried at the time the callback is received. If you want to receive a callback at a time when the new mesh data can be queried, use the following technique:

  • Use this method to register a topology-changed callback.
  • In the topology-changed callback, add an MNodeMessage::addAttributeChangedCallback on the mesh shape.
  • In the attribute-changed callback, check the inputs for an MNodeMessage::kAttributeEval message received by the "outMesh" plug of the mesh.
  • Once you have received the eval message on that plug, the attribute-changed callback can be removed and the mesh topology can be queried.
Parameters
[in]nodethe node the callback function should listen to
[in]functhe callback function
  • node the node whose topolgy has changed
Parameters
[in]clientDataUser defined data passed to the callback function
[out]ReturnStatusstatus code
Returns
Identifier used for removing the callback.
Status Codes:
  • MS::kSuccess Operation succeeded
  • MS::kInsufficientMemory No memory available
  • MS::kFailure Error adding callback, at least one of the want*IdModifications parameters must be true
MCallbackId addUVSetChangedCallback ( MObject node,
MPolyMessage::MNodeStringTypeFunction  func,
void *  clientData = NULL,
MStatus ReturnStatus = NULL 
)
static

This method registers a callback that will be called when UV set is modified.

Parameters
[in]nodethe node the callback function should listen to
[in]functhe callback function
[in]clientDataUser defined data passed to the callback function
[out]ReturnStatusstatus code
Returns
Identifier used for removing the callback.
Status Codes:
  • MS::kSuccess Operation succeeded
  • MS::kInsufficientMemory No memory available
  • MS::kFailure Error adding callback
unsigned int deletedId ( void  )
static

This method returns a constant which is to be used to determine if a component id has been deleted.

Compare component ids returned by the callback with the value return by this method. If they are the same then, the component id has been deleted.

Returns
Value of a deleted component id.
+ Examples:
const char * className ( )
static

Returns the name of this class.

Returns
The name of this class.

The documentation for this class was generated from the following files:
  • MPolyMessage.h
  • MPolyMessage.cpp