CaptureViewport

Introduced

v1.0

Description

Captures the viewport into an image sequence.

Note: This command does not work in normal batch mode because it relies on the Softimage user interface. However you can use the "-uiscript" command line argument instead of "-script" to use this command as part of a batch process.

Scripting Syntax

CaptureViewport( [Target], [Interactive] );

Parameters

Parameter Type Description
Target Long Viewport to capture.

Default Value: -1 (the current viewport, or viewport B if no current viewport)

Possible Values:

Description:

-1 The current viewport (under the cursor)
1 Viewport A
2 Viewport B
3 Viewport C
4 Viewport D
Interactive Boolean Specifies whether running in batch mode (False) or interactive mode (True)

Default Value: False

Examples

1. JScript Example

/*

	This example demonstrates how to perform a viewport capture via scripting.

	The File Format is specified by the File Name extension. To specify the codec parameters, 

	you can save a preset via the UI and then load the preset back by scripting anytime you need it.

	You can also specify the codec parameters by setting the "DSCodec" parameter, which

	contains an encoded string for the codec parameters. The string for a desired set of codec

	parameters can be obtained by doing a capture interactively as following:

	- in a 3D view, click the Camera pulldown menu > Start Capture to open the Capture Viewport dialog

	- select the desired format from the File Format pulldown menu

	- click Codec to select the desired parameters, click OK to exit the codec dialog

	- click OK to start a capture

	The encoded string for the codec parameters is printed in the Script History window. You

	can copy it for future use in scripting.

	You can also get the encoded codec parameters string by scripting, e.g.:

		LogMessage( GetValue("ViewportCapture.DSCodec"));

*/

// Get the current frame

var currFrame = ActiveProject.Properties.Item("Play Control").Parameters.Item("Current").Value;

// Set the capture options

var oViewportCapture = Dictionary.GetObject("ViewportCapture");

// Capture a 1-frame sequence 

oViewportCapture.NestedObjects.Item("Start Frame").Value = currFrame;

oViewportCapture.NestedObjects.Item("End Frame").Value = currFrame;         

// Specify the output file name

// The output file format is determined by the extension

oViewportCapture.NestedObjects.Item("File Name").Value = "C:\\test.mov";

// Set the Quicktime codec parameters (in this case: "Keyframe every 10 frames")

SetValue("ViewportCapture.DSCodec", "AAAAFnNwdGxycHphAAAAAAAQAAACAAAAABR0cHJsAAACAAAd+FEAAAAKAAAAGGRyYXQAAAAAAAAAUwAAAQAAAAEAAAAACW1wc28AAAAADG1mcmEAAAAAAAAADHBzZnIAAAAAAAAACWJmcmEAAAAACm1wZXMAAAAAABxoYXJkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKc2RuZQAAAAAADGNtZnJhcHBsAAAAAA==", null);

// Do not display dialog

CaptureViewport( 2, false );

2. VBScript Example

CreatePrim "Sphere", "NurbsSurface", "MySphere"

SetValue "PlayControl.Out", 40

' Setting a key frame on XPos at frame 1

SaveKey "MySphere.kine.local.posx", 1, -9.0

' Setting a key frame on XPos at frame 10

SaveKey "MySphere.kine.local.posx", 10, 3.0

' Setting a key frame on XPos at frame 30

SaveKey "MySphere.kine.local.posx", 30,-3.0

' Setting a key frame on XPos at frame 40

SaveKey "MySphere.kine.local.posx", 40, 9.0

' Setting a key frame on YPos at frame 1

SaveKey "MySphere.kine.local.posy", 1, -2.0

' Setting a key frame on YPos at frame 30

SaveKey "MySphere.kine.local.posy", 30, 2.0

SetDisplayMode "Camera", "shaded"

CaptureViewport 2, true

See Also

Flipbook Viewport Capture parameters