User Tools

Site Tools


DzImageRenderHandler

A render handler that renders into an image (or images).

More...

Inherits :

Inherited By : Dz3DViewRenderHandler and DzViewRenderHandler

Properties

DAZ Script
BooleanwriteToFile

Constructors

DAZ Script
DzImageRenderHandler ( Size size, DzTime renderTime, String filename )
DzImageRenderHandler ( Size size, DzTime startingTime, Number numFrames, String filename, Boolean isMovie )

Methods

Detailed Description

Has an array of QImage objects for capturing data from a renderer - one image will be created for each frame rendered.

Properties


Boolean : writeToFile

Holds whether each frame is written to file when finishFrame is called. The internal images is reset on each new frame.

Since:

  • 4.9.3.57

Constructors


DzImageRenderHandler( Size size, DzTime renderTime, String filename )

Create a new image render handler for rendering a single frame.

Parameter(s):

  • size - The width & height of the rendered image.
  • renderTime - The time to render the frame at.
  • filename - The filename to save the image to.

Example:

// Get the active viewport and camera
var oActiveView = MainWindow.getViewportMgr().getActiveViewport();
var oCamera = oActiveView.get3DViewport().getCamera();
 
// Get the render options
var oRenderOptions = App.getRenderOptions();
 
// Create a handler
var oHandler = new DzImageRenderHandler( oRenderOptions.getImageSize(), 0, App.getTempPath() + "/test.jpg" );
 
// If we have a valid handler
if( oHandler ){
	// Set the background color
	oHandler.setBackColor( oActiveView.get3DViewport().background );
 
	// Get the renderer
	var oRenderer = oRenderOptions.getActiveRenderer();
 
	// Render, using our handler and options
	oRenderer.render( oHandler, oCamera, oRenderOptions );
}

DzImageRenderHandler( Size size, DzTime startingTime, Number numFrames, String filename, Boolean isMovie )

Create a new image render handler for rendering a multiple frames.

Parameter(s):

  • size - The width & height of the rendered images.
  • startingTime - The time to start the render at.
  • numFrames - The number of frames to render.
  • filename - The name of the movie file or the base file name for the series.
  • isMovie - If true, the filename is expected to be a valid filename for saving a movie file, if false, it is expected to be a valid image name.

Example:

// Get the active viewport and camera
var oActiveView = MainWindow.getViewportMgr().getActiveViewport();
var oCamera = oActiveView.get3DViewport().getCamera();
 
// Get the render options
var oRenderOptions = App.getRenderOptions();
 
// Create a handler
var oHandler = new DzImageRenderHandler( oRenderOptions.getImageSize(), 0, 1, App.getTempPath() + "/test.jpg", false );
 
// Render if we have a handler
if( oHandler ){
	var oRenderer = oRenderOptions.getActiveRenderer();
	oRenderer.render( oHandler, oCamera, oRenderOptions );
}

Methods


void : beginFrame( Number frame )

Begins rendering the given frame


void : beginRender()

Starts a render


void : finishFrame()

Finishes rendering the current frame


void : finishRender()

Finishes the render and saves it out to file


Boolean : getCreateThumbnail()

Return Value:

  • true if a thumbnail is created, false otherwise

Image : getCurrentFrameImage()

Return Value:

  • The current frame's image. This image is reset at every call to beginFrame.

Number : getNumFrames()

Return Value:

  • The number of frames in the render

Size : getSize()

Return Value:

  • the size of the rendered image

DzTime : getStartingTime()

Return Value:

  • The starting time of the render

void : setCreateThumbnail( Boolean createThumb )

Sets whether a thumbnail is created

Parameter(s):

  • createThumb - If true, a thumbnail is created