Python API 2.0 Reference
OpenMayaRender.MRenderUtilities Class Reference
+ Inheritance diagram for OpenMayaRender.MRenderUtilities:

Static Public Member Functions

def acquireSwatchDrawContext ()
 
def acquireUVTextureDrawContext ()
 
def blitTargetToGL ()
 
def blitTargetToImage ()
 
def drawSimpleMesh ()
 
def releaseDrawContext ()
 
def renderMaterialViewerGeometry ()
 
def swatchBackgroundColor ()
 

Static Public Attributes

int kAmbientLight = 2
 
int kDefaultLights = 0
 
int kOrthogonalCameraCloseUp = 2
 
int kOrthogonalCameraWithMargin = 1
 
int kPerspectiveCamera = 0
 
int kSwatchLight = 1
 

Detailed Description

Utilities class for rendering in Viewport 2.0

Member Function Documentation

def OpenMayaRender.MRenderUtilities.acquireSwatchDrawContext ( )
static
acquireSwatchDrawContext() -> MDrawContext
acquireSwatchDrawContext(colorTarget) -> MDrawContext
acquireSwatchDrawContext(colorTarget, depthTarget) -> MDrawContext

Acquire a draw context fit for rendering a swatch.
The caller is responsible for releasing the draw context when it is no longer needed, by calling MRenderUtilities::releaseDrawContext().

* colorTarget (MRenderTarget) -  The color target for swatch drawing.
* depthTarget (MRenderTarget) -  The depth target for swatch drawing.
If targets are not provided, the caller is responsible for properly setting up render targets.
Specifying targets also insures that the proper GL context is made active when using GL devices.
def OpenMayaRender.MRenderUtilities.acquireUVTextureDrawContext ( )
static
acquireUVTextureDrawContext() -> MDrawContext
acquireUVTextureDrawContext(colorTarget) -> MDrawContext
acquireUVTextureDrawContext(colorTarget, depthTarget) -> MDrawContext

Acquire a draw context fit for rendering a texture for the UV editor.
The caller is responsible for releasing the draw context when it is no longer needed, by calling MRenderUtilities::releaseDrawContext().

* colorTarget (MRenderTarget) -  The color target for UV texture drawing.
* depthTarget (MRenderTarget) -  The depth target for UV texture drawing.
If targets are not provided, the caller is responsible for properly setting up render targets.
Specifying targets also insures that the proper GL context is made active when using GL devices.
def OpenMayaRender.MRenderUtilities.blitTargetToGL ( )
static
blitTargetToGL(target, region, unfiltered) -> None

Blit the data from a target to current GL context.

* target (MRenderTarget) - The source target to get the data from.
* region (float[2][2]) - Rectangular region to be rendered - [ [x1, y1], [x2, y2] ].
* unfiltered (bool) - Render with hardware filtering or sharply defined pixels.
def OpenMayaRender.MRenderUtilities.blitTargetToImage ( )
static
blitTargetToImage(target, image) -> None

Copy the data from a target to an image.

* target (MRenderTarget) - The source target to get the data from.
* image (MImage) - The destination image to copy the data to.
def OpenMayaRender.MRenderUtilities.drawSimpleMesh ( )
static
drawSimpleMesh(context, vertexBuffer, indexBuffer, primitiveType, start, count) -> None

Render a simple mesh.

* context (MDrawContext) - The draw context to use for render.
* vertexBuffer (MVertexBuffer) - The vertex buffer for the mesh.
* indexBuffer (MIndexBuffer) - The index buffer for the mesh.
* primitiveType (int) - The primitive type of the mesh. See MGeometry.primitiveString()
* start (int) - The location of the first index read from the index buffer.
* count (int) - The number of indices to draw.
def OpenMayaRender.MRenderUtilities.releaseDrawContext ( )
static
releaseDrawContext(context) -> None
releaseDrawContext(context, releaseTargets) -> None

Release a draw context.

* context (MDrawContext) - The draw context to release.
* releaseTargets (bool) - Removes the current draw targets from the device, defaults to true.
If releaseTargets is requested, the device will have NULL targets on function exit.
def OpenMayaRender.MRenderUtilities.renderMaterialViewerGeometry ( )
static
renderMaterialViewerGeometry(shape, shaderNode, image, cameraMode=kPerspectiveCamera, lightRig=kDefaultLights) -> None

Do an off-screen render replicating the results shown by the Material Viewer window of Hypershade..

* shape (str) Shape to render. Valid values include "meshSphere", "meshPlane", "meshShaderball", "meshTeapot", and "meshCloth".
* shaderNode (MObject) The shader node to use on the geometry.
* image (MImage) The image where the result should be stored.
* cameraMode (int) The camera to use for rendering. Defaults to MRenderUtilities.kPerspectiveCamera.
* lightRig (int) The light rig to use for rendering. Defaults to MRenderUtilities.kDefaultLights.
def OpenMayaRender.MRenderUtilities.swatchBackgroundColor ( )
static
swatchBackgroundColor() -> MColor

Returns the default background color for the hardware rendered swatch.