x.__init__(...) initializes x; see help(type(x)) for signature
Member Function Documentation
OpenMayaRender.MShaderInstance.activatePass
(
)
activatePass(MDrawContext, int) -> self
Activates the given pass of the shader.
Must be called between calls to bind() and unbind().
OpenMayaRender.MShaderInstance.addInputFragment
(
)
addInputFragment(fragmentName, outputName, inputName, promotedInputName=None) -> self
Connect a fragment that has been registered with the fragment manager to an input on the existing MShaderInstance.
Use this method to add shader instructions to an existing MShaderInstance.
The code defined in the fragment will be compiled and executed on the GPU to compute the value for the input parameter.
* fragmentName (string) - The name of a fragment that has been registered with the MFragmentManager.
* outputName (string) - The name of the output on the registered fragment to connect to.
* inputName (string) - The name of the input parameter on the MShaderInstance to connect to.* promotedInputName (string) - The name of the input parameter on the new fragment that will be promoted to replace the input parameter being connected to.
OpenMayaRender.MShaderInstance.addOutputFragment
(
)
addOutputFragment(fragmentName, inputName) -> self
Connect a fragment that has been registered with the fragment manager to an output on the existing MShaderInstance.
The code defined in the fragment will be compiled and executed on the GPU to modify the value returned by the original shader.
For example, use this method to add additional alpha or conditionals to the output color.
* fragmentName (string) - The name of a fragment that has been registered with the MFragmentManager.
* inputName (string) - The name of the input parameter on the fragment to connect the shaders output to.
OpenMayaRender.MShaderInstance.annotation
(
)
annotation(parameterName, annotationName) -> int / float / string
Returns the value of a named parameter annotation.
* parameterName (string) - The name of the parameter.
* annotationName (string) - The name of the annotation.
OpenMayaRender.MShaderInstance.bind
(
)
bind(MDrawContext) -> self
Binds the shader instance to the draw context, so that it is the active shader.
OpenMayaRender.MShaderInstance.clone
(
)
clone() -> MShaderInstance
Clone the shader. This will return a new MShaderInstance object which is identical to the existing shader.
createShaderInstanceWithColorManagementFragment(inputColorSpace) -> MShaderInstance
Return a new shader instance with Color Management fragment added, which is based on the callee.
The callee shader instance is the one used for rendering a render item with image(a MPxNode with image, etc.)
The new shader is completely independent of the original shader.
Setting parameter values on either shader after calling this function will have no effect on the other.
The function won't keep a copy of input parameter.
When the returned new shader instance is no longer needed, MShaderManager.releaseShader()
should be called to notify the shader manager that the caller is done with the shader.
* inputColorSpace (string) - The color space the current image is in
OpenMayaRender.MShaderInstance.getPassCount
(
)
getPassCount(MDrawContext) -> int
Returns the number of draw passes defined by the shader.
None if the shader instance or draw context was invalid.
OpenMayaRender.MShaderInstance.isArrayParameter
(
)
isArrayParameter(string) -> bool
Determine whether the named parameter is an array.
OpenMayaRender.MShaderInstance.isTransparent
(
)
isTransparent() -> bool
Return whether the shader will render with transparency.
parameterDefaultValue(parameterName) -> bool / int / float / tuple of float
Returns the default value of named parameter, None if no default value.
OpenMayaRender.MShaderInstance.parameterList
(
)
parameterList() -> list of string
Get the names of all parameters that are settable on this shader instance.
OpenMayaRender.MShaderInstance.parameterSemantic
(
)
parameterSemantic(parameterName) -> string
Returns the semantic associated to a named parameter.
OpenMayaRender.MShaderInstance.parameterType
(
)
parameterType(string) -> int
Get the type of the named parameter, returns kInvalid if parameter is not found.
OpenMayaRender.MShaderInstance.passAnnotation
(
)
passAnnotation(pass, annotationName) -> int / float / string
Returns the value of the current technique's pass annotation.
* pass (int) - The index of the pass.
* annotationName (string) - The name of the pass annotation.
OpenMayaRender.MShaderInstance.postDrawCallback
(
)
postDrawCallback() -> function/None
Returns the post-draw callback function set for the this shader instance.
Returns None if the callback function is not set or is not a python function.
OpenMayaRender.MShaderInstance.preDrawCallback
(
)
preDrawCallback() -> function/None
Returns the pre-draw callback function set for the this shader instance.
Returns None if the callback function is not set or is not a python function.
requiredVertexBuffers(MVertexBufferDescriptorList) -> self
Get the vertex buffer descriptors that describe the buffers required
by a given shader instance.
OpenMayaRender.MShaderInstance.resourceName
(
)
resourceName(parameterName) -> string
Returns the resource name of a named texture parameter.
The resource name of a texture parameter can be specified in the effect file using the 'ResourceName' annotation.
It allows users to define a default texture using an external file.
If no resource was defined for a texture, this function returns an empty string.
OpenMayaRender.MShaderInstance.semantic
(
)
semantic(string) -> string
Return the semantic for a named parameter.
OpenMayaRender.MShaderInstance.setArrayParameter
(
)
setArrayParameter(parameterName, sequence of bool, int) -> self
setArrayParameter(parameterName, sequence of int, int) -> self
setArrayParameter(parameterName, sequence of float, int) -> self
setArrayParameter(parameterName, sequence of MMatrix, int) -> self
Set the value of a named array parameter.
OpenMayaRender.MShaderInstance.setIsTransparent
(
)
setIsTransparent(bool) -> self
Set whether the shader will render with transparency.
OpenMayaRender.MShaderInstance.setParameter
(
)
setParameter(parameterName, bool) -> self
setParameter(parameterName, int) -> self
setParameter(parameterName, float) -> self
setParameter(parameterName, list of float) -> self
setParameter(parameterName, MFloatVector) -> self
setParameter(parameterName, MMatrix) -> self
setParameter(parameterName, MFloatMatrix) -> self
setParameter(parameterName, MTexture) -> self
setParameter(parameterName, MRenderTarget) -> self
setParameter(parameterName, MSamplerState) -> self
Set the value of the named parameter.
techniqueAnnotation(annotationName) -> int / float / string
Returns the value of the current technique annotation.
* annotationName (string) - The name of the technique annotation.
OpenMayaRender.MShaderInstance.techniqueNames
(
)
techniqueNames() -> list of strings
Returns a list of the technique names for the effect.
OpenMayaRender.MShaderInstance.uiName
(
)
uiName(parameterName) -> string
Returns the UI name associated with a named parameter.
The UI name can be specified in shader using the 'UIName' annotation.
The UI name can be used to specify the name that will be displayed in the Attribute Editor.
OpenMayaRender.MShaderInstance.uiWidget
(
)
uiWidget(parameterName) -> string
Returns the UI widget type associated with a named parameter.
The UI widget type can be specified in shader using the 'UIWidget' annotation.The UI widget can be used to specify which widget should be used to control the parameter in the Attribute Editor.
OpenMayaRender.MShaderInstance.unbind
(
)
unbind(MDrawContext) -> self
Unbinds the shader instance from the draw context.
OpenMayaRender.MShaderInstance.updateParameters
(
)
updateParameters(MDrawContext) -> self
Updates the bound shader instance with the current parameter data.
writeEffectSourceToFile(filePath) -> self
Write the source of the final OGSFX/HLSL/CgFX effect to a specified file. Use
this for debugging to see how fragments are turned into the final effect for
the current drawing API.
Note that the effect will not be written if the effect is not generated from
shader fragments or any of the shader fragments is marked as hidden.