The MUniformParameter class provides a high-level interface to hardware shader uniform parameters. By defining your shader's uniform parameters through this class, you allow Maya to handle the attributes, editing, serialisation, and caching for you in a standard way that ensure you'll be able to leverage future performance and functionlity improvements.
Inheritance diagram for OpenMayaRender.MUniformParameter:
x.__init__(...) initializes x; see help(type(x)) for signature
Member Function Documentation
OpenMayaRender.MUniformParameter.asBool
(
)
asBool(context) -> bool
Get the value of this uniform parameter as a boolean value.
Because some parameters can be shape-dependent, the method requires access to the current context being rendered.
* context (MDrawContext) - Draw context being used for render.
OpenMayaRender.MUniformParameter.asFloat
(
)
asFloat(context) -> float
Get the value of this uniform parameter as a float.
Because some parameters can be shape-dependent, the method requires access to the current context being rendered.
* context (MDrawContext) - Draw context being used for render.
OpenMayaRender.MUniformParameter.asFloatArray
(
)
asFloatArray(context) -> tuple of floats
Get the value of this uniform parameter as one or more floating point values.
Because some parameters can be shape-dependent, the method requires access to the current context being rendered.
* context (MDrawContext) - Draw context being used for render.
OpenMayaRender.MUniformParameter.asInt
(
)
asInt(context) -> int
Get the value of this uniform parameter as an integer.
Because some parameters can be shape-dependent, the method requires access to the current context being rendered.
* context (MDrawContext) - Draw context being used for render.
OpenMayaRender.MUniformParameter.asString
(
)
asString(context) -> string
Get the value of this uniform parameter as a string.
Because some parameters can be shape-dependent, the method requires access to the current context being rendered.
* context (MDrawContext) - Draw context being used for render.
OpenMayaRender.MUniformParameter.copy
(
)
copy(source) -> self
Copy data from source parameter.
* source (MUniformParameter) - The source parameter to copy from
OpenMayaRender.MUniformParameter.hasChanged
(
)
hasChanged(context) -> bool
Has the value of this parameter changed since the last time it was accessed?
This allows your shader to minimise state changes by only updating modified parameters.
* context (MDrawContext) - Draw context being used for render.
OpenMayaRender.MUniformParameter.isATexture
(
)
isATexture() -> bool
Returns True if this parameter represents a texture, False otherwise.
OpenMayaRender.MUniformParameter.name
(
)
name() -> string
Get the name of this parameter.
OpenMayaRender.MUniformParameter.numColumns
(
)
numColumns() -> int
Get the number of columns in this parameter.
OpenMayaRender.MUniformParameter.numElements
(
)
numElements() -> int
Get the number of elements in this parameter (including rows and columns).
OpenMayaRender.MUniformParameter.numRows
(
)
numRows() -> int
Get the number of rows in this parameter.
OpenMayaRender.MUniformParameter.plug
(
)
plug() -> MPlug
Get the plug managed by this parameter.
OpenMayaRender.MUniformParameter.semantic
(
)
semantic() -> int
Get the semantic of this parameter.
The list of available semantic values can be obtained with the following commands:
print filter(lambda k: k.startswith('kSemantic'), dir(maya.api.OpenMayaRender.MUniformParameter))
OpenMayaRender.MUniformParameter.setBool
(
)
setBool(value) -> self
Set the value of this uniform parameter as a boolean value.
Note that it is not possible to set shape-dependent parameters.
* value (bool) - the new value for this parameter.
OpenMayaRender.MUniformParameter.setDirty
(
)
setDirty() -> self
Mark the data for this parameter as dirty. This will force the parameter to report that it has been changed the next time it is accessed. This allows external events (e.g. device lost, texture management, etc) to force a shader to re-set parameters tied to externally managed resources.
OpenMayaRender.MUniformParameter.setFloat
(
)
setFloat(value) -> self
Set the value of this uniform parameter as a float.
Note that it is not possible to set shape-dependent parameters.
* value (float) - the new float value for this parameter.
OpenMayaRender.MUniformParameter.setFloatArray
(
)
setFloatArray(value) -> self
Set the value of this uniform parameter as one or more floating point values.
Note that it is not possible to set shape-specific parameters.
* value (tuple of floats) - a tuple of floats holding the new floating point value(s) for this parameter.
OpenMayaRender.MUniformParameter.setInt
(
)
setInt(value) -> self
Set the value of this uniform parameter as an integer value.
Note that it is not possible to set shape-dependent parameters.
* value (int) - the new value for this parameter.
OpenMayaRender.MUniformParameter.setString
(
)
setString(value) -> self
Set the value of this uniform parameter as a string.
Note that it is not possible to set shape-dependent parameters.
* value (string) - the new string value for this parameter.
OpenMayaRender.MUniformParameter.source
(
)
source() -> MPlug
Get the source plug connected to this parameter. Other than textures, this will typically be an invalid plug.
OpenMayaRender.MUniformParameter.type
(
)
type() -> int
Get the type of this parameter.
Available values:
kTypeUnknown,
kTypeBool,
kTypeInt,
kTypeFloat,
kType1DTexture,
kType2DTexture,
kType3DTexture,
kTypeCubeTexture,
kTypeEnvTexture,
kTypeString,
kTypeEnum
OpenMayaRender.MUniformParameter.userData
(
)
userData() -> int
Get the user data for this parameter. User data can be used to store plugin specific information that you want to associate with this parameter. Typically this will be used to store a handle to the effect parameter.
Property Documentation
OpenMayaRender.MUniformParameter.enumFieldNames
static
The field names of an enum attribute.
OpenMayaRender.MUniformParameter.keyable
static
The keyable state of this parameter
OpenMayaRender.MUniformParameter.rangeMax
static
The hard range upper bound for a numeric uniform parameter.
OpenMayaRender.MUniformParameter.rangeMin
static
The hard range lower bound for a numeric uniform parameter.
OpenMayaRender.MUniformParameter.softRangeMax
static
The soft range upper bound for a numeric uniform parameter.
OpenMayaRender.MUniformParameter.softRangeMin
static
The soft range lower bound for a numeric uniform parameter.