MaxwellMayaMaterialLayer class
Description
This class allows you to manipulate material layers. A layer can contain 0 or more BSDF components, an optional emitter component and an optional displacement component. There can only be one displacement component active on the material at a given time, so the material attributes class allows you to specify which layer provides the active displacement. See this section in the main manual for further details on how layers work.
Texturable attributes: opacity (AttrType_Double
). When this attribute is textured, the scalar value acts as a multiplier for the values sampled from the texture.
Base class: MaxwellMayaMaterialComponent
.
Methods
void | Destroy() |
bool | SetName(const MString& name) |
MString | GetName() const |
MaxwellMayaBSDF* | AddBSDF() |
unsigned int | GetNumBSDFs() const |
MaxwellMayaBSDF* | GetBSDF(unsigned int index) |
const MaxwellMayaBSDF* | GetBSDF(unsigned int index) const |
MaxwellMayaEmitter* | CreateEmitter() |
MaxwellMayaEmitter* | GetEmitter() |
const MaxwellMayaEmitter* | GetEmitter() const |
bool | HasEmitter() const |
void | RemoveEmitter() |
MaxwellMayaDisplacement* | CreateDisplacement() |
MaxwellMayaDisplacement* | GetDisplacement() |
const MaxwellMayaDisplacement* | GetDisplacement() const |
bool | HasDisplacement() |
void | RemoveDisplacement() |
void | SetEnabled(bool enabled) |
bool | GetEnabled() const |
bool | SetBlendMode(BlendMode mode) |
BlendMode | GetBlendMode() const |
Inherited methods |
void Destroy()
Destroys the layer, removing it from the parent material.
bool SetName(const MString& name)
MString GetName() const
Set or get the name which will be displayed for this layer in Maxwell Studio or in the material editor.
MaxwellMayaBSDF* AddBSDF()
Creates and returns a new BSDF component.
unsigned int GetNumBSDFs() const
Returns the number of BSDF components currently present in this layer. This method does not exist in Python.
MaxwellMayaBSDF* GetBSDF(unsigned int index)
const MaxwellMayaBSDF* GetBSDF(unsigned int index) const
Return the BSDF at the given index, or NULL
if the index is invalid. In Python, this method is replaced with GetBSDFs
, which takes no arguments returns a list of all the BSDFs in the layer.
MaxwellMayaEmitter* CreateEmitter()
Creates and returns a new emitter component. If the layer already contains an emitter, returns NULL
in C++ or raises maxwell.ParameterError
in Python.
MaxwellMayaEmitter* GetEmitter()
const MaxwellMayaEmitter* GetEmitter() const
Returns the emitter component for the layer. If there is no emitter, the C++ version returns NULL
and the Python version returns None
.
bool HasEmitter() const
This is a convenience method which allows you to check if an emitter component is present. It is equivalent to checking if GetEmitter
returns NULL
, but you don't have to worry about managing the returned pointer in case there is an emitter and you only wanted to check its existence. This method does not exist in Python, where the object returned by GetEmitter
is managed automatically by the garbage collector.
void RemoveEmitter()
Removes the emitter component, if any. The Python version will raise maxwell.ParameterError
if no emitter is present.
MaxwellMayaDisplacement* CreateDisplacement()
Creates and returns a new displacement component. If the layer already contains a displacement component, returns NULL
in C++ or raises maxwell.ParameterError
in Python.
MaxwellMayaDisplacement* GetDisplacement()
const MaxwellMayaDisplacement* GetDisplacement() const
Returns the displacement component. If there is no displacement, the C++ version returns NULL
and the Python version returns None
.
bool HasDisplacement() const
Convenience method for checking if the layer contains a displacement component. This method does not exist in Python. The reason why it exists in C++ is the same as for the HasEmitter
method documented above.
void RemoveDisplacement()
Removes the displacement component, if any. The Python version will raise maxwell.ParameterError
if no displacement is present.
void SetEnabled(bool enabled)
bool GetEnabled() const
Layers can be disabled, in which case they do not contribute to the material in any way.
Attribute name: enabled (AttrType_Bool
).
bool SetBlendMode(BlendMode mode)
BlendMode GetBlendMode() const
There are two possible blending modes for the layers:
BlendMode_Normal
: the resulting value islayer*opacity + existing*(1 - opacity)
.BlendMode_Additive
: additive blending, where the existing value is not multiplied by(1 - opacity)
.
Attribute name: blendMode (AttrType_Int
).