C++ API Reference
|
User defined poly triangulation support. More...
#include <MPxPolyTrg.h>
Public Types | |
typedef void(* | polyTrgFnct) (const float *vert, const float *norm, const int *loopSizes, const int nbLoop, const int nbTrg, unsigned short *trg) |
Pointer to a function which triangulates a poly face. | |
Public Types inherited from MPxNode | |
enum | Type { kDependNode, kLocatorNode, kDeformerNode, kManipContainer, kSurfaceShape, kFieldNode, kEmitterNode, kSpringNode, kIkSolverNode, kHardwareShader, kHwShaderNode, kTransformNode, kObjectSet, kFluidEmitterNode, kImagePlaneNode, kParticleAttributeMapperNode, kCameraSetNode, kConstraintNode, kManipulatorNode, kMotionPathNode, kClientDeviceNode, kThreadedDeviceNode, kAssembly, kSkinCluster, kGeometryFilter, kBlendShape, kLast } |
Defines the type of node. More... | |
enum | SchedulingType { kParallel, kSerial, kGloballySerial, kUntrusted , kDefaultScheduling = kSerial, kSerialize = kSerial, kGloballySerialize = kGloballySerial } |
Defines the degree of parallelism of a node. More... | |
Public Member Functions | |
MPxPolyTrg () | |
Constructor. More... | |
~MPxPolyTrg () override | |
Destructor. | |
void | postConstructor () override |
Post constructor. More... | |
MStatus | compute (const MPlug &plug, MDataBlock &dataBlock) override |
This method should be overridden in user defined nodes. More... | |
bool | isAbstractClass () const override |
Each new node has to implement that fuction. More... | |
MStatus | registerTrgFunction (const char *name, polyTrgFnct f) |
Register a triangulation function with maya. More... | |
MStatus | unregisterTrgFunction (const char *name) |
Public Member Functions inherited from MPxNode | |
MPxNode () | |
Constructor. More... | |
virtual | ~MPxNode () |
Destructor. | |
virtual bool | getInternalValue (const MPlug &, MDataHandle &) |
This method is overridden by nodes that store attribute data in some internal format. More... | |
virtual bool | setInternalValue (const MPlug &, const MDataHandle &) |
This method is overridden by nodes that store attribute data in some internal format. More... | |
virtual int | internalArrayCount (const MPlug &) const |
This method is overridden by nodes that have internal array attributes which are not stored in Maya's datablock. More... | |
virtual void | copyInternalData (MPxNode *) |
This method is overridden by nodes that store attribute data in some internal format. More... | |
virtual MStatus | legalConnection (const MPlug &, const MPlug &, bool asSrc, bool &isLegal) const |
This method allows you to check for legal connections being made to attributes of this node. More... | |
virtual MStatus | legalDisconnection (const MPlug &, const MPlug &, bool asSrc, bool &isLegal) const |
This method allows you to check for legal disconnections being made to attributes of this node. More... | |
virtual MStatus | setDependentsDirty (const MPlug &plug, MPlugArray &plugArray) |
This method can be overridden in user defined nodes to specify which plugs should be set dirty based upon an input plug {plugBeingDirtied} which Maya is marking dirty. More... | |
virtual MStatus | preEvaluation (const MDGContext &context, const MEvaluationNode &evaluationNode) |
Prepare a node's internal state for threaded evaluation. More... | |
virtual MStatus | postEvaluation (const MDGContext &context, const MEvaluationNode &evaluationNode, PostEvaluationType evalType) |
Clean up node's internal state after threaded evaluation. More... | |
virtual SchedulingType | schedulingType () const |
When overridden this method controls the degree of parallelism supported by the node during threaded evaluation. More... | |
virtual void | getCacheSetup (const MEvaluationNode &, MNodeCacheDisablingInfo &, MNodeCacheSetupInfo &, MObjectArray &) const |
Provide node-specific setup info for the Cached Playback system. More... | |
virtual void | configCache (const MEvaluationNode &, MCacheSchema &) const |
Defines the node's behavior when participating in Cached Playback. More... | |
virtual MTimeRange | transformInvalidationRange (const MPlug &source, const MTimeRange &input) const |
Override this method to register this node as an Invalidation-Range-Transformation kernel (IRT kernel) An IRT kernel node will change the invalidation time range for its downstream nodes For example, Dynamics-solver will transform invalidation time range [a,b] to [a,+inf) And Clip-Time-Editor will send out the invalidation range for each of the clip [a,b] to ( [t0+a,t0+b] U [t1+a,t1+b] U [t2+a,t2+b] U ... More... | |
bool | hasInvalidationRangeTransformation () const |
Checks if this MPxNode derived node overrides the MPxNode::transformInvalidationRange method. | |
virtual MStatus | connectionMade (const MPlug &, const MPlug &, bool asSrc) |
This method gets called when connections are made to attributes of this node. More... | |
virtual MStatus | connectionBroken (const MPlug &, const MPlug &, bool asSrc) |
This method gets called when connections are broken with attributes of this node. More... | |
virtual MStatus | dependsOn (const MPlug &, const MPlug &, bool &depends) const |
This method may be overridden by the user defined node. More... | |
virtual bool | isPassiveOutput (const MPlug &) const |
This method may be overridden by the user defined node if it wants to provide output attributes which do not prevent value modifications to the destination attribute. More... | |
virtual MStatus | shouldSave (const MPlug &, bool &isSaving) |
This method may be overridden by the user defined node. More... | |
virtual MPlug | passThroughToOne (const MPlug &) const |
This method may be overridden by nodes that have a one-to-one relationship between an input attribute and a corresponding output attribute. More... | |
virtual bool | passThroughToMany (const MPlug &, MPlugArray &) const |
This method is overridden by nodes that want to control the traversal behavior of some Maya search algorithms which traverse the history/future of shape nodes looking for directly related nodes. More... | |
virtual Type | type () const |
Returns the type of node that this is. More... | |
virtual bool | isTrackingTopology () const |
Override this class to return true if this node wants to track topology. More... | |
virtual MStringArray | getFilesToArchive (bool shortName=false, bool unresolvedName=false, bool markCouldBeImageSequence=false) const |
Use this method to return all external files used by this node. More... | |
virtual void | getExternalContent (MExternalContentInfoTable &table) const |
Returns the external content (files) that this node depends on. More... | |
bool | addExternalContentForFileAttr (MExternalContentInfoTable &, const MObject &attr) const |
Adds content info to the specified table from a file path attribute. More... | |
bool | setExternalContentForFileAttr (const MObject &attr, const MExternalContentLocationTable &) |
Sets content info in the specified attribute from the table. More... | |
virtual void | setExternalContent (const MExternalContentLocationTable &) |
Changes the location of external content in batch. More... | |
virtual MTypeId | typeId () const |
Returns the TYPEID of this node. More... | |
virtual MString | typeName () const |
Returns the type name of this node. More... | |
virtual MString | name () const |
Returns the name of this particular instance of this class. More... | |
virtual MObject | thisMObject () const |
Returns the MObject associated with this user defined node. More... | |
virtual MStatus | setExistWithoutInConnections (bool flag) |
This method specifies whether or not the node can exist without input connections. More... | |
virtual bool | existWithoutInConnections (MStatus *ReturnStatus=NULL) const |
Determines whether or not this node can exist without input connections. More... | |
virtual MStatus | setExistWithoutOutConnections (bool flag) |
This method specifies whether or not the node can exist without output connections. More... | |
virtual bool | existWithoutOutConnections (MStatus *ReturnStatus=NULL) const |
Determines whether or not this node can exist without output connections. More... | |
void | _setMPSafe (bool isMPSafe) |
This method is obsolete. More... | |
MDataBlock | _forceCache (const MDGContext &) |
This method is obsolete. More... | |
virtual bool | getInternalValueInContext (const MPlug &, MDataHandle &, MDGContext &) |
This method is obsolete. More... | |
virtual bool | setInternalValueInContext (const MPlug &, const MDataHandle &, MDGContext &) |
This method is obsolete. More... | |
virtual int | internalArrayCount (const MPlug &, const MDGContext &) const |
This method is obsolete. More... | |
Additional Inherited Members | |
Static Public Member Functions inherited from MPxNode | |
static MStatus | addAttribute (const MObject &attr) |
This method adds a new attribute to a user defined node type during the type's initialization. More... | |
static MStatus | inheritAttributesFrom (const MString &parentClassName) |
This method allows a class of plugin node to inherit all of the attributes of a second class of plugin node. More... | |
static MStatus | attributeAffects (const MObject &whenChanges, const MObject &isAffected) |
This method specifies that a particular input attribute affects a specific output attribute. More... | |
static MStatus | attributeAffects (const MObject &whenChanges, const MObject &isAffected, bool affectsTopology) |
This method is an extension to the other version of the attributeAffects method. More... | |
static const char * | className () |
Returns the name of this class. More... | |
Static Public Attributes inherited from MPxNode | |
static MObject | message |
message attribute | |
static MObject | isHistoricallyInteresting |
is historically interesting attribute | |
static MObject | caching |
caching attribute | |
static MObject | state |
state attribute | |
static MObject | frozen |
frozen attribute | |
Protected Member Functions inherited from MPxNode | |
virtual MDataBlock | forceCache () |
USE _forceCache() IN SCRIPT. More... | |
virtual MStatus | setDoNotWrite (bool flag) |
USE _setDoNotWrite() IN SCRIPT. More... | |
virtual bool | doNotWrite (MStatus *ReturnStatus=NULL) const |
USE _doNotWrite() IN SCRIPT. More... | |
virtual void | setMPSafe (bool isMPSafe) |
This method is obsolete. More... | |
virtual MDataBlock | forceCache (const MDGContext &) |
This method is obsolete. More... | |
User defined poly triangulation support.
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:
Derive a new node from MPxPolyTrg class.
Define a static function on the new node to triangulate a single face in the mesh. The signature of this function is given by polyTrgFnct type.
The input to the triangulation function is:
Note: The number of vertices can be calculated by adding all the loop sizes.
The output of this function is an array of triangle description:
Register that function when the node is created for the first time (in the postConstructor() method) by calling the registerTrgFunction().
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:
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.
OPENMAYA_MAJOR_NAMESPACE_OPEN MPxPolyTrg | ( | ) |
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.
|
overridevirtual |
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.
Reimplemented from MPxNode.
|
overridevirtual |
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.
[in] | plug | plug representing the attribute that needs to be recomputed |
[in] | block | data block containing storage for the node's attributes |
Reimplemented from MPxNode.
|
overridevirtual |
Each new node has to implement that fuction.
It returns false since this is not an abstract class.
Reimplemented from MPxNode.
MStatus registerTrgFunction | ( | const char * | functName, |
polyTrgFnct | funct | ||
) |
Register a triangulation function with maya.
The name provided as a first argument is the name under which the function is registered. This name has to be used when setting 'userTrg' attribute on a mesh.
[in] | functName | Function name under which the function is register with maya. |
[in] | funct | Pointer to the static function which implement a face triangulation. |
MStatus unregisterTrgFunction | ( | const char * | functName | ) |
[in] | functName | Function name under which the function is register with maya. |