User Tools

Site Tools


DzImageRenderHandler

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

More...

Inherits :

Inherited By : Dz3DViewRenderHandler and DzViewRenderHandler

Properties

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 : postProcessOnRenderFinish

Holds whether or not a post-process operation occurs when the render is finished.

Since:

  • 4.8.0.21

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 : addRenderFiles( Array files )

Adds files to this handler's list of rendered files.

Parameter(s):

  • files - The list of files to add.

Since:

  • 4.8.0.21

void : beginFrame( Number frame )

Begins rendering the given frame.

Parameter(s):

  • frame - The index of the frame.

void : beginRender()

Starts a render.


void : finishFrame()

Finishes rendering the current frame


void : finishRender()

Finishes the render and saves it to file.


Boolean : getCreateThumbnail()

Return Value:

  • true if a thumbnail is created, otherwise false.

Image : getCurrentFrameImage()

Return Value:

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

String : getFilename()

Return Value:

  • The filename that this handler is rendering to (if any), otherwise an empty string.

Since:

  • 4.8.0.18

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.