Python API 2.0 Reference
OpenMayaUI.MPxHwShaderNode Class Reference
+ Inheritance diagram for OpenMayaUI.MPxHwShaderNode:

Public Member Functions

def __init__ ()
 
def bind ()
 
def colorsPerVertex ()
 
def currentPath ()
 
def currentShadingEngine ()
 
def dirtyMask ()
 
def geometry ()
 
def getAvailableImages ()
 
def getColorSetNames ()
 
def getTexCoordSetNames ()
 
def glBind ()
 
def glGeometry ()
 
def glUnbind ()
 
def hasTransparency ()
 
def invertTexCoords ()
 
def normalsPerVertex ()
 
def provideVertexIDs ()
 
def renderImage ()
 
def renderSwatchImage ()
 
def supportsBatching ()
 
def texCoordsPerVertex ()
 
def transparencyOptions ()
 
def unbind ()
 
- Public Member Functions inherited from OpenMaya.MPxNode
def __init__ ()
 
def addExternalContentForFileAttr ()
 
def compute ()
 
def configCache ()
 
def connectionBroken ()
 
def connectionMade ()
 
def copyInternalData ()
 
def dependsOn ()
 
def doNotWrite ()
 
def existWithoutInConnections ()
 
def existWithoutOutConnections ()
 
def forceCache ()
 
def getCacheSetup ()
 
def getExternalContent ()
 
def getFilesToArchive ()
 
def getInternalValue ()
 
def getInternalValueInContext ()
 
def hasInvalidationRangeTransformation ()
 
def internalArrayCount ()
 
def isAbstractClass ()
 
def isPassiveOutput ()
 
def legalConnection ()
 
def legalDisconnection ()
 
def name ()
 
def passThroughToMany ()
 
def passThroughToOne ()
 
def postConstructor ()
 
def postEvaluation ()
 
def preEvaluation ()
 
def setDependentsDirty ()
 
def setDoNotWrite ()
 
def setExistWithoutInConnections ()
 
def setExistWithoutOutConnections ()
 
def setExternalContent ()
 
def setExternalContentForFileAttr ()
 
def setInternalValue ()
 
def setInternalValueInContext ()
 
def setMPSafe ()
 
def shouldSave ()
 
def thisMObject ()
 
def transformInvalidationRange ()
 
def type ()
 
def typeId ()
 
def typeName ()
 

Static Public Member Functions

def __new__ ()
 
def getHwShaderNode ()
 
- Static Public Member Functions inherited from OpenMaya.MPxNode
def __new__ ()
 
def addAttribute ()
 
def attributeAffects ()
 
def inheritAttributesFrom ()
 

Static Public Attributes

int kDirtyAll = 15
 
int kDirtyColorArrays = 4
 
int kDirtyNone = 0
 
int kDirtyNormalArray = 2
 
int kDirtyTexCoordArrays = 8
 
int kDirtyVertexArray = 1
 
int kIsTransparent = 1
 
int kNoTransparencyFrontBackCull = 2
 
int kNoTransparencyPolygonSort = 4
 
int kWriteAll = 15
 
int kWriteColorArrays = 4
 
int kWriteNone = 0
 
int kWriteNormalArray = 2
 
int kWriteTexCoordArrays = 8
 
int kWriteVertexArray = 1
 
 outColor = <OpenMaya.MObjectobject>
 
 outColorB = <OpenMaya.MObjectobject>
 
 outColorG = <OpenMaya.MObjectobject>
 
 outColorR = <OpenMaya.MObjectobject>
 
 outGlowColor = <OpenMaya.MObjectobject>
 
 outGlowColorB = <OpenMaya.MObjectobject>
 
 outGlowColorG = <OpenMaya.MObjectobject>
 
 outGlowColorR = <OpenMaya.MObjectobject>
 
 outMatteOpacity = <OpenMaya.MObjectobject>
 
 outMatteOpacityB = <OpenMaya.MObjectobject>
 
 outMatteOpacityG = <OpenMaya.MObjectobject>
 
 outMatteOpacityR = <OpenMaya.MObjectobject>
 
 outTransparency = <OpenMaya.MObjectobject>
 
 outTransparencyB = <OpenMaya.MObjectobject>
 
 outTransparencyG = <OpenMaya.MObjectobject>
 
 outTransparencyR = <OpenMaya.MObjectobject>
 
- Static Public Attributes inherited from OpenMaya.MPxNode
int kAssembly = 22
 
int kBlendShape = 25
 
int kCameraSetNode = 16
 
int kClientDeviceNode = 20
 
int kConstraintNode = 17
 
int kDeformerNode = 2
 
int kDependNode = 0
 
int kEmitterNode = 6
 
int kEvaluatedDirectly = 1
 
int kEvaluatedIndirectly = 0
 
int kFieldNode = 5
 
int kFluidEmitterNode = 13
 
int kGeometryFilter = 24
 
int kHardwareShader = 9
 
int kHwShaderNode = 10
 
int kIkSolverNode = 8
 
int kImagePlaneNode = 14
 
int kLast = 26
 
int kLeaveDirty = 2
 
int kLocatorNode = 1
 
int kManipContainer = 3
 
int kManipulatorNode = 18
 
int kMotionPathNode = 19
 
int kObjectSet = 12
 
int kParticleAttributeMapperNode = 15
 
int kPostEvaluationTypeLast = 3
 
int kSkinCluster = 23
 
int kSpringNode = 7
 
int kSurfaceShape = 4
 
int kThreadedDeviceNode = 21
 
int kTransformNode = 11
 

Detailed Description

Base class for user defined hardware shaders.

Method resolution order:
-   MPxHwShaderNode
-   OpenMaya.MPxNode
-   builtins.object

Constructor & Destructor Documentation

def OpenMayaUI.MPxHwShaderNode.__init__ ( )
Initialize self.  See help(type(self)) for accurate signature.

Member Function Documentation

def OpenMayaUI.MPxHwShaderNode.__new__ ( )
static
Create and return a new object.  See help(type) for accurate signature.
def OpenMayaUI.MPxHwShaderNode.bind ( )
bind(request, view) -> self

This method is invoked for hardware rendering to Maya's 3D view.

This is the preferred method of interactive feedback and performance. the "gl" version should be used for batch hardware rendering.

This method is called to set up the OpenGL state.  It would typically ensure that textures were bound and that any specific OpenGL extensions are enabled.  A status code of MS::kSuccess should be returned unless there was a problem during the display, such as insufficient memory or required input data is missing or invalid.

* request (MDrawRequest) - the draw request.
* view (M3dView) - the view in which to draw.
def OpenMayaUI.MPxHwShaderNode.colorsPerVertex ( )
colorsPerVertex() -> int

This method returns the number of color values per vertex that the hw shader node would like to receive from Maya.  Maya will attempt to provide all the color data that the shader would like but it will never provide more data that is actually available in the shape.  The color sets returned by getColorSetNames() will override the number of color sets specified by colorsPerVertex(). If you do not override this method or getColorSetNames(), Maya will provide no colors per vertex.

Returns the number of color values desired
def OpenMayaUI.MPxHwShaderNode.currentPath ( )
currentPath() -> MDagPath

This method returns a reference to the current path that the shader is invoked for.

The path is only valid before a call to any of the attribute specifying routines:

   normalsPerVertex()
   colorsPerVertex()
   getColorSetNames()
   texCoordsPerVertex()
   getTexCoordSetNames()
   hasTransparency()
   provideVertexIDs()

The path is not guaranteed to be valid at any other time.

This method allows the plugin to return attribute queries which are relative to a specific path or object.

For example, the plugin can retrieve the MObject from the path, then use the MFnMesh class on the MObject, assuming the object is a polygonal surface. Through MFnMesh the code can query the actual number of texture coordinate sets on the surface and return appropriate values for the getTexCoordSetNames() routine.

The [gl]bind(), [gl]unbind() and [gl]geometry() routines already have access to a dag path which is the same path as the one which can be retrieved via this method.

For performance reasons, it is recommended that for those methods the MDagPath passed in as an argument should be used.

Returns an MDagPath. Note that this path can be invalid
Use MDagPath.isValid() to confirm the validity of the path.
def OpenMayaUI.MPxHwShaderNode.currentShadingEngine ( )
currentShadingEngine() -> MObject

This method returns an MObject to the shading engine that is currently being rendered. This method will only return a valid MObject during the following calls:

  normalsPerVertex()
  colorsPerVertex()
  getColorSetNames()
  texCoordsPerVertex()
  getTexCoordSetNames()
  hasTransparency()
  provideVertexIDs()
  getAvailableImages()
  bind(), glBind()
  geometry(), glGeometry()
  unbind(), glUnbind()
def OpenMayaUI.MPxHwShaderNode.dirtyMask ( )
dirtyMask() -> int

This method returns a "dirty" mask that indicates which geometry items have changed from the last invocation of the plugin to draw. The mask is valid at the time that geometry() or glGeometry() is called and at no other time.

Note that this mask is relative to the geometry for the current object (path) being drawn by the shader. The current path is the MDagPath argument passed in via the geometry routines.

In general the mask will mark the geometry as not being dirty.

Scenarios where the geometry will be marked dirty include:

  Whenever a geometry attribute changes. For example positions or normals are modified.
  Whenever the attributes being requested changes from the previous invocation of the shader. For example, if in the previous invocation the plugin asks for position only, and in the current invocation asks for position and normals, then the geometry attributes returned will have changed and thus be marked "dirty".

Returns the dirty mask which can be bit 'AND'ed against the values:
  kDirtyNone
  kDirtyVertexArray
  kDirtyNormalArray
  kDirtyColorArrays
  kDirtyTexCoordArrays
  kDirtyAll
def OpenMayaUI.MPxHwShaderNode.geometry ( )
geometry(request, view, prim, writable, indexCount, indexArray, vertexCount, vertexIDs, vertexArray, normalCount, normalArrays, colorCount, colorArrays, texCoordCount, texCoordArrays) -> self

This method is invoked for hardware rendering to Maya's 3D view.

This is the preferred method of interactive feedback and performance. the "gl" version should be used for batch hardware rendering.

This method does all the actual OpenGL drawing.  The arguments contain all the data to successfully call glDrawElements or glDrawRangeElements.  It is possible that there will be multiple calls to this method surrounded by a single call to bind() and unbind().

Note 1.
The array of vertex IDs returned corresponds to each triangle's vertex. This allows access to associated blind data per vertex. The vertexIDs array allows querying of information such as color per vertex etc.

Note 2.
The arrays passed to this method can contain sparse information.  Check array positions against None to ensure that the array information item is valid.

It is necessary to use the indexArray to access information contained in the data arrays.

* request (MDrawRequest) - the draw request.
* view (M3dView) - the view in which to draw.
* prim (int) - the type of primitive to draw.  This is one of the values accepted by glBegin().  Typically it will be GL_TRIANGLES but it could be any of the others.
* writable (int) this is a mask which indicates which of the various array arguments can be modified in place.  If a bit in writable is set then you can modify corresponding data array (after casting it to a non-const type).  If the bit is not set in writable then you must not> modify the data since it points to internal Maya storage.  You can test the bits in writeable against the values
:  kWriteNone
  kWriteVertexArray
  kWriteNormalArray
  kWriteColorArrays
  kWriteTexCoordArrays
  kWriteAll
* indexCount (int) - specifies both the number of indices to draw and the size of the indexArray argument.
* indexArray (buffer of int values) - the array of index values.  This array is in a format suitable for passing as the indices argument to glDrawElements() or glDrawRangeElements().  See the OpenGL documentation for details on calling these routines.
* vertexCount (int) - the number of elements in the vertexArray, the normalArray, each of the colorArrays, and each of the texCoordArrays.
* vertexIDs (buffer - int values) - the component IDs of the vertices in vertexArray. This array is only provided if it was requested by overriding the provideVertexIDs() method to return True.
* vertexArray (buffer - float values) - the array of vertex data.  Currently, this is always 3 element floating point values.  This data is in a format suitable for passing to glVertexPointer().  See the OpenGL documentation for details.
* normalCount (int) - the number of individual "normal" arrays that are being provided in normalArrays.  See the description of normalsPerVertex method below for details.
* normalArrays (array of buffer - float values) - the normal (and tangent) data suitable. There may be 0, 1, 2, or 3 "normal" arrays.  See the description of the normalsPerVertex method below for details.
* colorCount (int) - the number of individual color arrays.
* colorArrays (array of buffer - float values) - the arrays of color data.  The first set of color data is pointed to by colorArrays[0].  Each color array contains vertexCount color values, each of which is 4 floating point values long and represents the red, green, blue, and alph values on a 0 to 1 scale.  Each individual array is suitable for passing to glColorPointer().
* texCoordCount (int) - the number of texture coordinate arrays. Each array contains one set of UV texture coordinates.
* texCoordArrays (array of buffer - float values) - the arrays of texture coordinate data. The first set of texture coordinate data is pointed to by texCoordArrays[0].  Each array contains vertexCount coordinate values, each of which is 2 floating point values long.  Each individual array is suitable for passing to glTexCoordPointer().
def OpenMayaUI.MPxHwShaderNode.getAvailableImages ( )
getAvailableImages(uvSetName) -> list of strings/None

Maya will call this method to get your shader's list of images which are available for use in the UV texture editor for the UV set specified. Typically, this list will include one entry for each texture using the specified UV set, however, your shader is free to return as many images as you wish (for example, blending between two textures, texture alpha masks, artificially shaded views of bump/normal maps, etc). Your shader's renderImage() method will be used to render the images themselves.

* uvSetName (string) - Name of a UV set the channel list should be filtered against.

Returns the names of the images this shader defines which are valid for the uvSetName specified.
Returns None if method is not implemented : Use the default behaviour.
def OpenMayaUI.MPxHwShaderNode.getColorSetNames ( )
getColorSetNames(names) -> int

This method returns an array of color per vertex set names. Maya will attempt to provide color per vertex data from these maps in the corresponding array element in the colorArrays argument to the geometry method.  For example, if the names[2] is "cpv56" then colorArrays[2] will be the array of values from cpv56, or None if the shape being rendered does not have a color set of that name. Ifthis method is not overridden an empty list of names will be returned,and Maya will use colorsPerVertex() to determine how many color setsto provide.

* names [IN/OUT] (list of string) - a string array holding the names of the color per vertex sets from which color data should be extracted.

Returns the number of elements in the names array.
def OpenMayaUI.MPxHwShaderNode.getHwShaderNode ( )
static
getHwShaderNode(object) -> MPxHwShaderNode

This is a static convenience method to be able to get an MPxHwShaderNode from an MObject provided by a swatch generator class (Class derived from MSwatchRenderRegister).

* object (MObject) - The object to examine.
def OpenMayaUI.MPxHwShaderNode.getTexCoordSetNames ( )
getTexCoordSetNames(names) -> int

This method returns an array of texture coordinate set names. Maya will attempt to provide texture coordinates from these maps in the corresponding array element in the texCoordArrays argument to the geometry method.  For example, if the names[2] is "uvSet3" then texCoordArrays[2] will be the array of values from uvSet3. If this method is not overridden an empty list of names will be returned, and Maya will use texCoordsPerVertex() to determine how many uv sets to provide.

* names [IN/OUT] (list of string) - a string array holding the names of the uvSets from which texture coordinate data should be extracted.

Returns the number of elements in the names array.
def OpenMayaUI.MPxHwShaderNode.glBind ( )
glBind(shapePath) -> self

This method should only be overridden for hardware rendering.

The implementation can assume the graphics context and model view projection matrix have already been set.

This method will be invoked once per frame and should be overridden to allocate any resources needed for the draw. For example, binding vertex programs, fragment programs, or allocating textures. A status code of MS::kSuccess should be returned unless there was a problem such as insufficient memory or required input data is missing or        invalid.

* shapePath (MDagPath) - Path to the surface being drawn.
def OpenMayaUI.MPxHwShaderNode.glGeometry ( )
glGeometry(shapePath, prim, writable, indexCount, indexArray, vertexCount, vertexIDs, vertexArray, normalCount, normalArrays, colorCount, colorArrays, texCoordCount, texCoordArrays) -> self

This method should only be overridden for hardware rendering.

The implementation can assume graphics context and model view projection matrix have already been set.

This method does all the actual OpenGL drawing.  The arguments contain all the data to successfully call glDrawElements or glDrawRangeElements.  It is possible that there will be multiple calls to this method surrounded by a single call to bind() and unbind().

Note 1.
The array of vertex IDs returned corresponds to each triangle's vertex. This allows access to associated blind data per vertex. The vertexIDs array allows querying of information such as color per vertex etc.

Note 2.
The arrays passed to this method can contain sparse information.  Check array positions against None to ensure that the array information item is valid.

It is necessary to use the indexArray to access information contained in the data arrays.

* shapePath (MDagPath) - Path to the surface being drawn.
See geometry() description for detail on the other parameters.
def OpenMayaUI.MPxHwShaderNode.glUnbind ( )
glUnbind(shapePath) -> self

This method should only be overridden for hardware rendering.

The implementation can assume the graphics context and model view projection matrix have already been set.

This method will be invoked once per frame and should be overridden to deallocate any resources used to draw. It's important that all resources be released when a batch hardware render has occured because the graphics context will be deleted. It may be desireable to override the other version of bind/unbind to keep track of whether the draw is for the 3D view or the batch hardware renderer. This information could then be used to better track the reuse of resources and optimize performance.

A status code of MS::kSuccess should be returned unless there was a problem.

* shapePath (MDagPath) - Path to the surface being drawn.
def OpenMayaUI.MPxHwShaderNode.hasTransparency ( )
hasTransparency() -> bool

This method returns a boolean value that indicates whether the object will be drawn transparently or not.  Transparent objects must be drawn after all the opaque objects in the scene or they will not display correctly.  Maya uses the return value to determine when it can draw this shape.

Note : The functionality in this method has been subsumed by the transparencyOptions() method. It is recommended that shader node writers use this newer method as it provides greater control over how transparency is interpreted by Maya's refresh mechanism.

For backward compatibility, if this method is specified and returns True, it will override the transparencyOptions() method.

Returns True if the object will be transparent or False if it will not.
def OpenMayaUI.MPxHwShaderNode.invertTexCoords ( )
invertTexCoords() -> bool

Specifies whether this shader requires inverted texture coordinates. (i.e. where the top-left hand corner of UV space is (0,0) instead of the bottom-left corner).

By default, this method will return False to ensure compatibility with existing shader code.
def OpenMayaUI.MPxHwShaderNode.normalsPerVertex ( )
normalsPerVertex() -> int

Specifies how many normals per vertex the HW shader would like Maya to provide.  This can range from 0 to 3.  The first normal is the surface normal.  The second "normal" is the primary tangent (generally the "u" direction).  The third "normal" is the secondary tangent or the binormal (generally the "v" direction). Together, the normal, tangent and binormal form an orthogonal basis frequently named "tangent space basis".

The tangent and binormal vectors are guaranteed to be normalized and orthogonal to the surface normal. Please note that extracting the tangent and/or binormal requires expensive calculations, that will slow down refresh time substantially. In a future version, Maya may cache the resulting tangent space basis; in the meantime, only ask for more than one normal per vertex if they are absolutely required.

Also note that the tangent and binormal calculation requires a uv map. Currently, they are always computed from the first available uv map; if there is no uv mapping on the surface, Maya will only provide surface normals in the geometry call, regardless of the value returned by normalsPerVertex().

If you do not override this method, Maya will provide 1 normal per vertex.

Maya will automatically and silently clamp the result of this function to the [0,3] range.

COMPATIBILITY NOTE: Automatic tangent space basis calculation is only supported starting with Maya 4.0.1. Maya 4.0 supported a different scheme that was much more complicated and no longer supported.

Returns the number of normal values desired. (0 = none, 1 = surface normal only, 2 = surface normal + tangent, 3 = surface normal + tangent + binormal)
def OpenMayaUI.MPxHwShaderNode.provideVertexIDs ( )
provideVertexIDs() -> bool

This method returns a boolean value that indicates whether a map of the vertex IDs will be provided to the geometry method.

Returns True if vertex IDs should be provided to the geometry method.
def OpenMayaUI.MPxHwShaderNode.renderImage ( )
renderImage(imageName, region, parameters) -> [int, int]/None
renderImage(uiDrawManager, imageName, region, parameters) -> [int, int]/None

This method allows you to to render the background image used for this shader in the UV texture editor. The image requested will be one of the image names returned by your shader's getAvailableImages() method.

The implementation must return the dimensions of the image in the 'imageWidth' and 'imageHeight' parameters so that Maya can perform pixel snapping and other resolution-dependent operations.

The implementation can assume OpenGL context, model view projection matrix, and texture transformations have already been set. A default color of white will be set, however you are free to change this. The magnification filter will be set to either point or bilinear based on user configuration and should not be modified. The values of GL_TEXTURE_WRAP_S and GL_TEXTURE_WRAP_T are undefined on entry, and your implementation is responsible for setting them to appropriate values (e.g. GL_REPEAT).

The arguments contain the name of the image to render, and the vertex and texture coordinate values to use at each corner of the rectangular image being rendered. Your implementation is responsible for restoring the original the value of any OpenGL state that is modified.

* imageName (string) - Name of the image to render. This corresponds to one of the image names returned by your shader's getAvailableImages() method.
* region (float[2][2]) - Rectangular region to be rendered. The values of this parameter should be used to populate the vertex and texture coordinates of the rectangle being rendered.
* parameters (RenderParamters) - Additional parameters on how to render the image. The values reflect the image settings of the UV editor.

A second version with the uiDrawManager parameter allows you to to render the background image used for this shader in the UV texture editor in viewport 2.0.

* uiDrawManager (MUIDrawManager) - The UI draw manager, it can be used to draw some simple geometry

Returns None if method is not implemented : No rendering will occur.
def OpenMayaUI.MPxHwShaderNode.renderSwatchImage ( )
renderSwatchImage(image) -> self/None

If the shader specifies to override swatch rendering, then this method must be overridden in order to draw anything into a swatch.

The shader will only draw a swatch if it has been registered to do so, by providing a valid classification during MFnPlugin::registerNode(). The shader should provide a classification that defines a swatch rendering node such as : "shader/surface/utility/:drawdb/shader/surface/myCustomShader:swatch/myCustomShaderSwatchGenerator" and have "myCustomShaderSwatchGenerator" registered has a swatch renderer : MSwatchRenderRegister.registerSwatchRender("myCustomShaderSwatchGenerator", MHWShaderSwatchGenerator.createObj );

The default implementation is to draw nothing. The basic logic to draw a swatch is as follows:

  Determine the size of the swatch required. This is the dimensions of the MImage passed in as an argument. The pixels for the MImage will have been pre-allocated. The format of the pixels is 32-bit R,G,B,A, with 8-bits per channel.
  Either use an offscreen "swatch context" provided to you or use your own offscreen context. The provided context is available via the MHardwareRenderer class method makeSwatchContextCurrent(). Note that the swatch context may be smaller than the desired image size. In this case the rendering dimensions will be clamped.
  Either use swatch geometry provided to you, or use your own swatch geometry. The provided geometry is available via the method MHardwareRenderer::referenceDefaultGeometry(). The possible "default" geometries are either a sphere, cube or plane.
  Either use the provided "default" light and "default" camera or set up your own. Use the methods (getSwatchOrthoCameraSetting(), getSwatchLightDirection()) on MHardwareRenderer to get these defaults.
  Read back the swatch context into the provided MImage. The convenience method MHardwareRenderer::readSwatchContextPixels() can be used. By default the format of the MImage and the swatch context are the same, so the user does not need to worry about this. The context will read into the pre-allocated MImage pixels.
  Unreference any swatch geometry used for rendering using MHardwareRenderer::dereferenceGeometry().

* image [IN/OUT] (MImage) - Image object to which this method must write the rendered swatch. On input the image's dimensions are already set and pixel storage already allocated.

Returns None if method is not implemented : No rendering will occur.
def OpenMayaUI.MPxHwShaderNode.supportsBatching ( )
supportsBatching() -> bool

Specifies whether or not this shader supports batched rendering of shapes.

In normal rendering, a shader is invoked using bind/geometry/unbind (or glBind/glGeometry/glUnbind) once for each shape being rendered. When a shader is used in batched rendering mode however, bind is called once, a series of geometry calls are made for each shape being rendered, followed by a single call to unbind (and similarly for glBind, glGeometry and glUnbind). As shader binding/unbinding can be expensive, batched rendering can significantly improve rendering performance. The more (particularly expensive) operations that can be moved out of the geometry/glGeometry methods the greater the performance improvement is. Ideally, only shape specific operations (such as binding geometry arrays and shape matrices) should be left in the geometry methods.

It is important to note that your shader can only use batched rendering mode if there is no shape (i.e. dag path) specific code in bind, glBind, unbind, or glUnbind. If any of these methods perform shape specific processing, this code must either be moved into geometry/glGeometry, or you must return False in this method to indicate batching should be disabled for this shader.

By default, this method will return False to ensure compatibility with existing shader code.
def OpenMayaUI.MPxHwShaderNode.texCoordsPerVertex ( )
texCoordsPerVertex() -> int

This method returns the number of texture coordinate values per vertex that the hw shader node would like to receive from Maya. Maya will attempt to provide all the texture coordinate data that the shader would like but it will never provide more data than is actually available in the shape.  The uv sets returned by getTexCoordSetNames() will override the number of uv sets specified by texCoordsPerVertex(). If you do not override this method or getTexCoordSetNames(), Maya will provide no texture coordinates per vertex.

Note: Currently, Maya only retains 2 dimensional texture coordinate data but this may change in a future release.

Returns the number of texture coordinate values desired
def OpenMayaUI.MPxHwShaderNode.transparencyOptions ( )
transparencyOptions() -> int

This method returns transparency options for usage as hints for Maya's internal draw during a given rendering pass. Parameters are returned via an integer containing masked out bits. By default the mask is set to 0, meaning that the drawing should be treated as regular opaque object drawing. This will generally mean one call per draw pass.

Options to control transparency are specified by returning one or more masks specified by the values
:

  kIsTransparent : Draw as a transparent object. If no transparency overrides are specified, then control of how to draw during a given pass is determined internally by Maya's refresh algorithm, and options the user can set per modelling viewport.
  kNoTransparencyFrontBackCull : When kisTransparent is set and this flag is set, do not perform transparency drawing using the internal 2-pass front-face + back-face culling algorithm.
  kNoTransparencyPolygonSort : When kisTransparent is set and this flag is set, do not perform transparency drawing using the internal 2-pass drawing of back-to-front sorted triangles.

Note : Setting the "hasTransparency()" method to True will override this method. This is for backward compatibility with behaviour on existing hardware shader nodes. It is recommended that shaders use the "transparencyOptions()" override, and not longer use the older "hasTransparency()" override from their shader classes.

Retuns an integer containing the appropriate options set via masks.
def OpenMayaUI.MPxHwShaderNode.unbind ( )
unbind(request, view) -> self

This method is invoked for hardware rendering to Maya's 3D view.

This is the preferred method of interactive feedback and performance. the "gl" version should be used for batch hardware rendering.

This method is called to restore the OpenGL state.  Specifically, it must disable any OpenGL extensions that the matching bind() method may have enabled.  This is necessary to ensure that the rest of Maya's drawing code continues to work correctly.  A status code of MS::kSuccess should be returned unless there was a problem such as insufficient memory or required input data is missing or invalid.

The arguments passed to this method are the same ones that were passed to the bind() method.

* request (MDrawRequest) - the draw request.
* view (M3dView) - the view in which to draw.