class MPxPolyTrg

Jump to documentation

: public MPxNode User defined poly triangulation support. (OpenMaya) (OpenMayaMPx.py)

Inheritance:

MPxPolyTrg < MPxNode

public members:

MPxPolyTrg ()
virtual ~MPxPolyTrg ()
virtual void postConstructor ()
virtual MStatus compute ( const MPlug & plug, MDataBlock & dataBlock )
virtual bool isAbstractClass () const
MStatus registerTrgFunction ( char *name, polyTrgFnct f )
MStatus unregisterTrgFunction ( char *name )

Inherited from MPxNode:

public members:

enum Type
kDependNode
kLocatorNode
kDeformerNode
kManipContainer
kSurfaceShape
kFieldNode
kEmitterNode
kSpringNode
kIkSolverNode
kHardwareShader
Custom shader derived from MPxHardwareShader
kHwShaderNode
Custom shader derived from MPxHwShaderNode
kTransformNode
kObjectSet
kFluidEmitterNode
kImagePlaneNode
kParticleAttributeMapperNode
kConstraintNode
kLast
virtual void postConstructor ()
virtual MStatus compute ( const MPlug & plug, MDataBlock & dataBlock )
virtual bool getInternalValueInContext ( const MPlug & plug, MDataHandle & dataHandle, MDGContext & ctx)
virtual bool setInternalValueInContext ( const MPlug & plug, const MDataHandle & dataHandle, MDGContext & ctx)
virtual bool getInternalValue ( const MPlug & plug, MDataHandle & dataHandle)
virtual bool setInternalValue ( const MPlug & plug, const MDataHandle & dataHandle)
virtual int internalArrayCount ( const MPlug & plug, const MDGContext & ctx) const
virtual void copyInternalData ( MPxNode * )
virtual MStatus legalConnection ( const MPlug & plug, const MPlug & otherPlug, bool asSrc, bool& isLegal ) const
virtual MStatus legalDisconnection ( const MPlug & plug, const MPlug & otherPlug, bool asSrc, bool& isLegal ) const
virtual MStatus setDependentsDirty ( const MPlug & plug, MPlugArray & plugArray)
virtual MStatus connectionMade ( const MPlug & plug, const MPlug & otherPlug, bool asSrc )
virtual MStatus connectionBroken ( const MPlug & plug, const MPlug & otherPlug, bool asSrc )
virtual bool isPassiveOutput ( const MPlug & plug ) const
virtual MStatus shouldSave ( const MPlug & plug, bool& isSaving )
virtual MPlug passThroughToOne ( const MPlug & plug ) const
virtual bool passThroughToMany ( const MPlug & plug, MPlugArray & plugArray ) const
MTypeId typeId () const
MString typeName () const
MString name () const
virtual Type type () const
virtual bool isAbstractClass () const
MObject thisMObject () const
static MStatus addAttribute ( const MObject & attr )
static MStatus inheritAttributesFrom ( const MString & parentClassName )
static MStatus attributeAffects ( const MObject & whenChanges, const MObject & isAffected )
MStatus setExistWithoutInConnections ( bool flag )
bool existWithoutInConnections ( MStatus * ReturnStatus = NULL ) const
MStatus setExistWithoutOutConnections ( bool flag )
bool existWithoutOutConnections ( MStatus * ReturnStatus = NULL ) const
static MObject message
static MObject isHistoricallyInteresting
static MObject caching
static MObject state

protected members:

MDataBlock forceCache ( MDGContext & ctx= MDGContext::fsNormal )
void setMPSafe ( bool flag )
MStatus setDoNotWrite ( bool flag )
bool doNotWrite ( MStatus *ReturnStatus = NULL ) const

Documentation

Description

MPxPolyTrg is the the parent class for nodes which define a custom face triangulation for meshes. In order to override default maya triangulation, the user has to do the following things:

Once the node is defined, the user has to inform the mesh about it. For each mesh the user wants to override the default triangulation, he has to set the usertTrg attribute on the mesh to the name under which the function has been registered.

Example: setAttr mesh.userTrg -type "string" "triangulate";

Once that attribute is set, the default maya triangulation is turned off and the one provided by the user is used to draw the mesh.

Functions

MPxPolyTrg:: MPxPolyTrg ()
Description

Constructor.

The constructor should never call any methods from MPxPolyTrg or make any calls that require the existence of the MObject associated with the user defined node. The postConstructor method should be used to do any initialization of this kind.

MPxPolyTrg:: ~MPxPolyTrg ()
Description

Destructor.

void MPxPolyTrg:: postConstructor ()
Description

Post constructor.

Internally maya creates two objects when a user defined node is created, the internal MObject and the user derived object. The association between the these two objects is not made until after the MPxPolyTrg constructor is called. This implies that no MPxPolyTrg member function can be called from the MPxPolyTrg constructor. The postConstructor will get called immediately after the constructor when it is safe to call any MPxPolyTrg member function.

MStatus MPxPolyTrg:: compute ( const MPlug & plug, MDataBlock & block )

Description

This method should be overridden in user defined nodes. However, fror this particaular node we don't need to to do anything in the compute functione. Therefore, all we do is return MS:kSuccess in the derive class.

Arguments

  • plug plug representing the attribute that needs to be recomputed
  • block data block containing storage for the node's attributes

Return Value

  • Status code

Status Codes

  • MS::kSuccess Compute was successful
  • MS::kFailure Compute failed

bool MPxPolyTrg:: isAbstractClass () const

Description Each new node has to implement that fuction. It returns false since this is not an abstract class.

Arguments

Return Value False

MStatus MPxPolyTrg:: registerTrgFunction ( char *functName, polyTrgFnct funct )

Description Register a triangulation function with maya. The name provided as a firrst argument is the name under which the function is registered. This name has to be used when setting 'userTrg' attribute on a mesh.

Arguments

  • functName - function name under which the function is register with maya.

  • funct - pointer to the static function which implement a face triangulation.

Return Value

  • Status code

Status Codes

  • MS::kSuccess Compute was successful
  • MS::kFailure Compute failed

MStatus MPxPolyTrg:: unregisterTrgFunction ( char *functName )

Description

Arguments

  • functName - function name under which the function is register with maya.

Return Value

  • Status code

Status Codes

  • MS::kSuccess Compute was successful
  • MS::kFailure Compute failed

This class has no child classes.


Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. doc++ Copyright