C++ API Reference: MGPUDeformerRegistrationInfo Class Reference

MGPUDeformerRegistrationInfo Class Referenceabstract

Registration information for an MPxGPUDeformer. More...

#include <MGPUDeformerRegistry.h>

Public Member Functions

virtual MPxGPUDeformercreateGPUDeformer ()=0
 This method allocates an MPxGPUDeformer. More...
 
virtual bool validateNodeInGraph (MDataBlock &block, const MEvaluationNode &evaluationNode, const MPlug &plug, MStringArray *messages)=0
 This method is called once for each instance of the overridden deformation node type in a Maya scene. More...
 
virtual bool validateNodeValues (MDataBlock &block, const MEvaluationNode &evaluationNode, const MPlug &plug, MStringArray *messages)=0
 This method is called once for each instance of the overridden deformation node type in a Maya scene. More...
 
virtual const MObject outputMeshAttribute ()
 This method returns the output mesh attribute for the node type being overridden. More...
 
virtual const MObject inputMeshAttribute ()
 This method is depreciated, please use inputMeshAttributes instead. More...
 
virtual void inputMeshAttributes (MObjectArray &inputAttributes)
 This method fills inputAttributes with attributes which should be searched for upstream deformation supported by GPU Override. More...
 
virtual bool matchAncestorLogicalIndices (const MPlug &original, MPlug &target)
 This method is used together with inputMeshAttributes and a specific output MPlug (with all ancestor logical indices set) to generate a specific input plug for the deformer node. More...
 
virtual const MObject passThroughInputMeshAttribute ()
 This method returns the input mesh attribute for the node type being overridden which has a special "pass through" relationship with the output mesh attribute. More...
 

Detailed Description

Registration information for an MPxGPUDeformer.

MGPUDeformerRegistrationInfo provides a creator method to allocate MPxGPUDeformer objects, validation methods to determine if a given node is supported by the MPxGPUDeformer, as well as utility methods to tell the deformer evaluator which attributes are the input and output mesh attributes of the deformer node.

You must implement createGPUDeformer(), validateNodeInGraph() and validateNodeValues(). outputMeshAttribute(), inputMeshAttributes() and passThroughInputMeshAttribute have default implementations which will work correctly if the node being overridden by MPxGPUDeformer is an MPxDeformerNode.

If the attribute returned by outputMeshAttribute() is a multi-attribute or a multi parent, then the attribute returned by inputMeshAttribute() must also be a multi-attribute or have a multi parent. The total number of multi attributes in the hierarchy of the output attribute (including the output attribute itself) must be exactly one. The total number of multi attributes in the hierarchy of the input attribute (including the input attribute itself) must be greater than or equal to the number of multi attributes in the hierarchy of the output attribute.

For example, geometryFilter's input geometry attribute is inputGeometry. inputGeometry is not a multi attribute, but it has a single multi parent (input). geometryFilter's output geometry attribute is outputGeometry. outputGeometry is a multi attribute. In this case the input and output attribute hierarchies each have a single multi, so the GPU override works.

Maya will match the multi index of each multi attribute in the input and output multi hierarchies for each connected input and output plug, starting from the root plug. In the geometryFilter example we use the multi index of the outputGeometry attribute as the multi index of aInput when attempting to determine if inputGeometry is connected.

+ Examples:

Member Function Documentation

OPENMAYA_MAJOR_NAMESPACE_OPENMPxGPUDeformer * createGPUDeformer ( )
pure virtual

This method allocates an MPxGPUDeformer.

Returns
An MPxGPUDeformer of the appropriate type.
+ Examples:
bool validateNodeInGraph ( MDataBlock block,
const MEvaluationNode evaluationNode,
const MPlug plug,
MStringArray messages 
)
pure virtual

This method is called once for each instance of the overridden deformation node type in a Maya scene.

This method returns True if the specific instance of the node represented by MEvaluationNode and MDataBlock is supported by the corresponding MPxGPUDeformer. A return value of False from this method prevents the deformation chain that includes this specific instance of the deformer from being included in GPU evaluation. See MPxGPUDeformer documentation for more information about deformation chains.

validateNodeInGraph should test conditions which depend on the topology of Maya's dependency graph (connected attributes, global state) or values which can only change when the topology of the graph changes. validateNodeInGraph should not test specific values of attributes in the data block. Attribute value tests should be performed in validateNodeValues.

validateNodeInGraph is only called during evaluation manager graph scheduling and will not be called again until the graph is re-scheduled.

Parameters
[in]blockThe data block of the deformer node to be validated.
[in]evaluationNodeThe evaluation node that corresponds to the deformer to be validated.
[in]plugThe output plug of the deformer to be validated.
[in]messagesIf non-NULL store messages to the user explaining why the node was not validated.
Returns
True if the deformer is supported.
+ Examples:
bool validateNodeValues ( MDataBlock block,
const MEvaluationNode evaluationNode,
const MPlug plug,
MStringArray messages 
)
pure virtual

This method is called once for each instance of the overridden deformation node type in a Maya scene.

This method returns True if the specific instance of the node represented by MEvaluationNode and MDataBlock is supported by the corresponding MPxGPUDeformer. A return value of False from this method prevents the deformation chain that includes this specific instance of the deformer from being included in GPU evaluation. See MPxGPUDeformer documentation for more information about deformation chains.

validateNodeValues should test specific values of attributes in the data block. validateNodeValues should not test conditions which depend on the topology of Maya's dependency graph.

validateNodeValues will be called before each call to MPxGPUDeformer::evaluate to ensure that the state of the underlying Maya node has not changed in a way which prevents the MPxGPUDeformer from supporting it.

validateNodeValues will be called for unsupported nodes each time the value a conditional attribute changes. If the previously unsupported node is now supported, GPU Override will enable for the node.

Parameters
[in]blockThe data block of the deformer node to be validated.
[in]evaluationNodeThe evaluation node that corresponds to the deformer to be validated.
[in]plugThe output plug of the deformer to be validated.
[in]messagesIf non-NULL store messages to the user explaining why the node was not validated.
Returns
True if the deformer is supported.
+ Examples:
const MObject outputMeshAttribute ( )
virtual

This method returns the output mesh attribute for the node type being overridden.

The number of multi attributes in the input mesh attribute hierarchy must be equal to or greater than the number of multi attributes in the output mesh attribute hierarchy.

This method is optional if and only if the MPxGPUDeformer is being used to override an MPxDeformerNode or a geometryFilter.

Returns
An MObject representing the output mesh attribute.
const MObject inputMeshAttribute ( )
virtual

This method is depreciated, please use inputMeshAttributes instead.

This method returns the input mesh attribute for the node type being overridden. The number of multi attributes in the input mesh attribute hierarchy must be equal to or greater than the number of multi attributes in the output mesh attribute hierarchy.

This method is optional if and only if the MPxGPUDeformer is being used to override an MPxDeformerNode or a geometryFilter.

Returns
An MObject representing the input mesh attribute.
void inputMeshAttributes ( MObjectArray inputAttributes)
virtual

This method fills inputAttributes with attributes which should be searched for upstream deformation supported by GPU Override.

Ownership off the MObject's returned in inputAttributes remains with the callee. Maya will not delete the MObjects.

Parameters
[out]inputAttributesAttributes to search for upstream deformation chains.
+ Examples:
bool matchAncestorLogicalIndices ( const MPlug original,
MPlug target 
)
virtual

This method is used together with inputMeshAttributes and a specific output MPlug (with all ancestor logical indices set) to generate a specific input plug for the deformer node.

This function should set none, some or all of the ancestor logical index values on target. The choice of which indices to set and to which values depends on the internal logic of the deformer. Any logical index on target which is invalid after a call to matchAncestorLogicalIndices will be treated as a wildcard which matches every element in the specific multi attribute array.

If matchAncestorLogicalIndices returns false then Maya will attempt to match logical indices automatically. Multi-index values are matched starting from the root plug and working downwards.

By default matchAncestorLogicalIndices returns false and Maya will automatically match logical indices to the best of it's ability.

Parameters
[in]originalan output plug for a deformer node with all ancestor logical indices set
[in,out]targetan input plug for the deformer node with all ancestor logical indices invalid
Returns
true if ancestor logical indices were set, false to use Maya's default matching
const MObject passThroughInputMeshAttribute ( )
virtual

This method returns the input mesh attribute for the node type being overridden which has a special "pass through" relationship with the output mesh attribute.

If MPxGPUDeformer::evaluate() returns kDeformerPassThrough then all input buffers matching the passThroughInputMeshAttribute plug will be automatically copied to the output mesh data. Additionally, when MPxGPUDeformer::evaluate() succeeds, any input buffers matching the passThroughInputMeshAttribute and not explicitly set in outputData will be automatically copied in output data. Typically this would be the geometryMatrix and inverseGeometryMatrix.

This method is optional if and only if the MPxGPUDeformer is being used to override an MPxDeformerNode or a geometryFilter.

Returns
An MObject representing the pass through input mesh attribute.

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