#include <MPxShadingNodeOverride.h>
Class for defining relationship between Maya attributes and fragment parameters.
MAttributeParameterMapping allows implementations of MPxShadingNodeOverride to describe which attribute on a Maya node drives which parameter on the corresponding shader fragment or fragment graph. The plugin can provide a list of mappings in getCustomMappings(). Additional mappings will be automatically created by Maya after getCustomMappings() is called for any attributes that have a parameter on the fragment or fragment graph with the same name and type.
Public Member Functions | |
MAttributeParameterMapping (const MString ¶mName, const MString &attrName, bool allowConnection, bool allowRename) | |
Constructor. More... | |
~MAttributeParameterMapping () | |
Destructor. | |
const MString & | parameterName () const |
Get the parameter name for this mapping. More... | |
const MString & | resolvedParameterName () const |
Get the resolved parameter name for this mapping. More... | |
const MString & | attributeName () const |
Get the attribute name for this mapping. More... | |
bool | allowConnection () const |
This method returns true if Maya is allowed to connect other shade fragments to the parameter named by this mapping. More... | |
bool | allowRename () const |
This method returns true if the parameter named by this mapping may be renamed in the final shading effect. More... | |
Static Public Member Functions | |
static const char * | className () |
Returns the name of this class. More... | |
MAttributeParameterMapping | ( | const MString & | paramName, |
const MString & | attrName, | ||
bool | allowConnection, | ||
bool | allowRename | ||
) |
Constructor.
Define the association between an attribute on the Maya node and a parameter on the shade fragment.
The attribute name for a mapping may be set to the empty string to indicate that the parameter on the fragment is not directly associated with any attribute on the node but that it should still be tracked and renamed (if allowRename is true). The parameter name must always be non-empty and must exist as a parameter on the associated shading fragment.
[in] | paramName | The name of the parameter on the shading fragment |
[in] | attrName | The name of the attribute on the Maya node |
[in] | allowConnection | Set to false to prevent Maya from connecting any other fragment to the parameter named by this mapping |
[in] | allowRename | Set to false to prevent Maya from renaming the parameter named by this mapping |
const MString & parameterName | ( | ) | const |
Get the parameter name for this mapping.
const MString & resolvedParameterName | ( | ) | const |
Get the resolved parameter name for this mapping.
After the fragment has been joined with other fragments to form the final shading effect its parameters are renamed to prevent name collisions. This returns the name of the parameter on the final shading effect. This name is useful in MPxShadingNodeOverride::updateShader() for setting parameter values manually.
If the fragment has not yet been joined with other fragments, this will return the same string as parameterName().
const MString & attributeName | ( | ) | const |
Get the attribute name for this mapping.
bool allowConnection | ( | ) | const |
This method returns true if Maya is allowed to connect other shade fragments to the parameter named by this mapping.
bool allowRename | ( | ) | const |
This method returns true if the parameter named by this mapping may be renamed in the final shading effect.
If false, name collisions of parameters will be unresolved and results will be unpredictable.
|
static |
Returns the name of this class.