OpenMayaRender.MUniformParameter Class Reference

Class Description

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:

Public Member Functions

__init__ ()
 
asBool ()
 
asFloat ()
 
asFloatArray ()
 
asInt ()
 
asString ()
 
copy ()
 
hasChanged ()
 
isATexture ()
 
name ()
 
numColumns ()
 
numElements ()
 
numRows ()
 
plug ()
 
semantic ()
 
setBool ()
 
setDirty ()
 
setFloat ()
 
setFloatArray ()
 
setInt ()
 
setString ()
 
source ()
 
type ()
 
userData ()
 

Static Public Attributes

int kSemanticBackgroundColor = 46
 
int kSemanticBump = 11
 
int kSemanticBumpTexture = 30
 
int kSemanticColor = 9
 
int kSemanticColorTexture = 28
 
int kSemanticEnvironment = 12
 
int kSemanticFrameNumber = 47
 
int kSemanticHWSEdgeLevel = 52
 
int kSemanticHWSFaceLevel = 51
 
int kSemanticHWSFrontCCW = 55
 
int kSemanticHWSHighlighting = 57
 
int kSemanticHWSInstancedDraw = 56
 
int kSemanticHWSObjectLevel = 50
 
int kSemanticHWSOccluder = 54
 
int kSemanticHWSPrimitiveBase = 48
 
int kSemanticHWSPrimitiveCountPerInstance = 49
 
int kSemanticHWSVertexLevel = 53
 
int kSemanticLocalViewer = 44
 
int kSemanticNormal = 10
 
int kSemanticNormalTexture = 29
 
int kSemanticNormalizationTexture = 31
 
int kSemanticObjectDir = 1
 
int kSemanticObjectPos = 5
 
int kSemanticOpaqueDepthTexture = 33
 
int kSemanticProjectionDir = 4
 
int kSemanticProjectionInverseMatrix = 20
 
int kSemanticProjectionInverseTransposeMatrix = 21
 
int kSemanticProjectionMatrix = 19
 
int kSemanticProjectionPos = 8
 
int kSemanticProjectionTransposeMatrix = 37
 
int kSemanticTime = 34
 
int kSemanticTranspDepthTexture = 32
 
int kSemanticUnknown = 0
 
int kSemanticViewDir = 3
 
int kSemanticViewInverseMatrix = 17
 
int kSemanticViewInverseTransposeMatrix = 18
 
int kSemanticViewMatrix = 16
 
int kSemanticViewPos = 7
 
int kSemanticViewProjectionInverseMatrix = 41
 
int kSemanticViewProjectionInverseTransposeMatrix = 43
 
int kSemanticViewProjectionMatrix = 40
 
int kSemanticViewProjectionTransposeMatrix = 42
 
int kSemanticViewTransposeMatrix = 36
 
int kSemanticViewportPixelSize = 45
 
int kSemanticWorldDir = 2
 
int kSemanticWorldInverseMatrix = 14
 
int kSemanticWorldInverseTransposeMatrix = 15
 
int kSemanticWorldMatrix = 13
 
int kSemanticWorldPos = 6
 
int kSemanticWorldTransposeMatrix = 35
 
int kSemanticWorldViewInverseMatrix = 23
 
int kSemanticWorldViewInverseTransposeMatrix = 24
 
int kSemanticWorldViewMatrix = 22
 
int kSemanticWorldViewProjectionInverseMatrix = 26
 
int kSemanticWorldViewProjectionInverseTransposeMatrix = 27
 
int kSemanticWorldViewProjectionMatrix = 25
 
int kSemanticWorldViewProjectionTransposeMatrix = 39
 
int kSemanticWorldViewTransposeMatrix = 38
 
int kType1DTexture = 4
 
int kType2DTexture = 5
 
int kType3DTexture = 6
 
int kTypeBool = 1
 
int kTypeCubeTexture = 7
 
int kTypeEnum = 10
 
int kTypeEnvTexture = 8
 
int kTypeFloat = 3
 
int kTypeInt = 2
 
int kTypeString = 9
 
int kTypeUnknown = 0
 

Properties

 enumFieldNames
 
 keyable
 
 rangeMax
 
 rangeMin
 
 softRangeMax
 
 softRangeMin
 
 uiHidden
 
 uiNiceName
 

Constructor & Destructor Documentation

OpenMayaRender.MUniformParameter.__init__ ( )
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.
OpenMayaRender.MUniformParameter.uiHidden
static
 The hidden state of this parameter
OpenMayaRender.MUniformParameter.uiNiceName
static
 The UI Nice Name for the attribute.