MAttributeParameterMapping Class Reference

#include <MPxShadingNodeOverride.h>

Class Description

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.

+ Examples:

Public Member Functions

 MAttributeParameterMapping (const MString &paramName, const MString &attrName, bool allowConnection, bool allowRename)
 Constructor. More...
 
 ~MAttributeParameterMapping ()
 Destructor.
 
const MStringparameterName () const
 Get the parameter name for this mapping. More...
 
const MStringresolvedParameterName () const
 Get the resolved parameter name for this mapping. More...
 
const MStringattributeName () 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...
 

Constructor & Destructor Documentation

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.

Parameters
[in]paramNameThe name of the parameter on the shading fragment
[in]attrNameThe name of the attribute on the Maya node
[in]allowConnectionSet to false to prevent Maya from connecting any other fragment to the parameter named by this mapping
[in]allowRenameSet to false to prevent Maya from renaming the parameter named by this mapping

Member Function Documentation

const MString & parameterName ( ) const

Get the parameter name for this mapping.

Returns
The name of the parameter 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().

Returns
The resolved name of the parameter for this mapping
+ Examples:
const MString & attributeName ( ) const

Get the attribute name for this mapping.

Returns
The name of the attribute 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.

Returns
True if connections are allowed
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.

Returns
True if the parameter may be renamed
const char * className ( )
static

Returns the name of this class.

Returns
Name of this class.

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