class MRenderView

Jump to documentation

Static class providing Render View API functions (OpenMayaRender) (OpenMayaRender.py)

public members:

static bool doesRenderEditorExist ()
static MStatus setCurrentCamera ( MDagPath & camera )
static MStatus getRenderRegion ( unsigned int& left, unsigned int& right, unsigned int& bottom, unsigned int& top )
static MStatus startRender ( unsigned int width, unsigned int height, bool doNotClearBackground = false, bool immediateFeedback = false )
static MStatus startRegionRender ( unsigned int imageWidth, unsigned int imageHeight, unsigned int regionLeft, unsigned int regionRight, unsigned int regionBottom, unsigned int regionTop, bool doNotClearBackground = false, bool immediateFeedback = false )
static MStatus updatePixels ( unsigned int left, unsigned int right, unsigned int bottom, unsigned int top, RV_PIXEL* pPixels )
static MStatus refresh ( unsigned int left, unsigned int right, unsigned int bottom, unsigned int top )
static MStatus endRender ()

Documentation

Static class providing Render View API functions (OpenMayaRender) (OpenMayaRender.py)
Description
This class provides access to the Maya Render View. The class allows plugins to send image data to the Render View in the same was that the Maya renderer does. Either a "full render" or a "region render" can be performed. In a full render, the Render View expects to receive pixel data that fills the entire image, while a region render expects only updates to a specified image region.

Usage

To send an image to the Render View, use the following sequence of calls:

Functions

bool MRenderView:: doesRenderEditorExist ()
Description

Determines whether or not a Render View exists to receive image data. If this function returns false, then Maya is currently running in batch mode, so it would be pointless to try to send data to the Render View.

Return Value

  • true if the Render View exists.
  • false otherwise.

MStatus MRenderView:: setCurrentCamera ( MDagPath & currentCamera )
Description

Informs the render client of the camera that will be performing the rendering.

Return Value

  • MS::kSuccess Operation was successful.
  • MS::kFailure Operation failed because no Render View existed.

MStatus MRenderView:: getRenderRegion ( unsigned int& left, unsigned int& right, unsigned int& bottom, unsigned int& top )
Description

Retrieves the currently selected Render Region in Maya's Render View. The region extends from the bottom-left corner (left,bottom) to the upper-right corner (right,top) inclusive (i.e. the row y=top and column x=right are part of the region).

Arguments

  • left receives the left extent of the region
  • right receives the right extent of the region
  • bottom receives the bottom extent of the region
  • top receives the top extent of the region

Return Value

  • MS::kSuccess Operation was successful, returned values are valid.
  • MS::kFailure Operation failed because no Render View existed.

MStatus MRenderView:: startRender ( unsigned int width, unsigned int height, bool doNotClearBackground, bool immediateFeedback )
Description

Informs the Render View that a full image render is about to begin. The entire Render View buffer will be cleared in anticipation of receiving an entire image.

Arguments

  • width width of the image to be sent to the Render View (must be greater than zero).
  • height height of the image to be sent to the Render View (must be greater than zero).
  • doNotClearBackground When true, the Render View is not cleared before starting to draw. Default (false) is to clear the Render View.
  • immediateFeedback When true, each call to refresh() will immediately redraw the Render View. Default (false) is to wait at least two seconds between redraws.

Return Value

  • MS::kSuccess Operation was successful.
  • MS::kInvalidParameter Operation failed because the specified width or height was invalid.
  • MS::kFailure Operation failed because no Render View existed.

MStatus MRenderView:: startRegionRender ( unsigned int imageWidth, unsigned int imageHeight, unsigned int regionLeft, unsigned int regionRight, unsigned int regionBottom, unsigned int regionTop, bool doNotClearBackground, bool immediateFeedback )
Description

Informs the Render View that a region render is about to begin. The specified region will be cleared in anticipation of receiving new image data for it. The specified region must lie within the image region (0,0)->(imageWidth-1,imageHeight-1). The region 'left' coordinate must be less than the region 'right' coordinate, and the region 'bottom' coordinate must be less than the region 'top' coordinate.

Arguments

  • imageWidth width of the image in which the region is embedded. (must be greater than zero).
  • imageHeight height of the image in which the region is embedded (must be greater than zero).
  • regionLeft left extent of the region.
  • regionRight right extent of the region. The column x=regionRight is considered part of the region.
  • regionBottom bottom extent of the region.
  • regionTop top extent of the region. The row y=regionTop is considered part of the region.
  • doNotClearBackground When true, the Render View is not cleared before starting to draw. Default (false) is to clear the Render View.
  • immediateFeedback When true, each call to refresh() will immediately redraw the Render View. Default (false) is to wait at least two seconds between redraws.

Return Value

  • MS::kSuccess Operation was successful.
  • MS::kInvalidParameter Operation failed because either the specified image width/height or the specified image region was invalid.
  • MS::kFailure Operation failed because no Render View existed.

MStatus MRenderView:: updatePixels ( unsigned int left, unsigned int right, unsigned int bottom, unsigned int top, RV_PIXEL* pPixels )
Description

Sends a block of pixels to the Render View. Pixel colours are represented as 4-channel floating point values in the range (0,255.0).

Arguments

  • left left extent of the update region.
  • right right extent of the update region. The column x=right is considered part of the region.
  • bottom bottom extent of the update region.
  • top top extent of the update region. The row y=regionTop is considered part of the region.
  • pPixels buffer containing the pixel data for the image. The buffer should contain (right-left+1)*(top-bottom+1) pixels.

Return Value

  • MS::kSuccess Operation was successful.
  • MS::kInvalidParameter Operation failed, either because the specified update region was invalid, or because the specified pixel buffer was NULL.
  • MS::kFailure Operation failed because no Render View existed.

MStatus MRenderView:: refresh ( unsigned int left, unsigned int right, unsigned int bottom, unsigned int top )
Description

Requests that the Render View refresh the display of a particular region of the displayed image.

Arguments

  • left left extent of the update region.
  • right right extent of the update region. The column x=right is considered part of the region.
  • bottom bottom extent of the update region.
  • top top extent of the update region. The row y=regionTop is considered part of the region.
  • pPixels buffer containing the pixel data for the image. The buffer should contain (right-left+1)*(top-bottom+1) pixels.

Return Value

  • MS::kSuccess Operation was successful.
  • MS::kInvalidParameter Operation failed, because the specified refresh region was invalid.
  • MS::kFailure Operation failed because no Render View existed.

MStatus MRenderView:: endRender ()
Description

Informs the Render View that the current render has completed. The Render View is refreshed and no further updates are accepted.

Return Value

  • MS::kSuccess Operation was successful.
  • MS::kFailure Operation failed because no Render View existed.

This class has no child classes.


Autodesk® Maya® 2008 © 1997-2007 Autodesk, Inc. All rights reserved. doc++ Copyright