MGPUDeformerRegistrationInfo Class Reference

#include <MGPUDeformerRegistry.h>

Class 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() and inputMeshAttribute() 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 exactly one.

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. 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:

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 returns the input mesh attribute for the node type being overridden. More...
 

Member Function Documentation

MPxGPUDeformer * 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.

If outputMeshAttribute is a multi-attribute, input mesh attribute must also be a multi-attribute. 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 returns the input mesh attribute for the node type being overridden.

If inputMeshAttribute is a multi-attribute, output mesh attribute must also be a multi-attribute. 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.

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