Skip to content

FxView ​

This module contains functions to control the viewport.

Load ​

lua
FxView = require "FxView";

Functions ​

FunctionDescription
Capture (Filename)Saves the current view as an image file.
FrameNode (NodeID)Moves the camera so it has specified nodes in its field of view.
FrameScene ()Moves the camera so it has all objects in its field of view.
GetCamera ()Returns the active camera.
SetCamera (NodeID)Activates a camera.

Capture (Filename) ​

This function saves the current view as an image file.

Parameters ​

  • Filename: The absolute file path the image file is to be saved as

Errors ​

Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_FILE_OPERATION_FAILED

Since ​

Version 1.0

Example ​

lua
FxView.Capture("c:\\myfolder\\capture.png");

FrameNode (NodeID) ​

This function moves the camera to a position where it has the specified nodes in its field of view.

Parameters ​

NodeID: The NodeID to identify the nodes to frame

Errors ​

Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_NODE_NOT_FOUND

Since ​

Version 1.0

Example ​

lua
-- frame selected nodes
FxView.FrameNode("/s");

FrameScene () ​

This function moves the camera to a position where it has all objects in its field of view.

Errors ​

Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE

Since ​

Version 1.0

Example ​

lua
FxView.FrameScene();

GetCamera () ​

This function returns the ID of the active camera. If the active camera is the default camera then an empty string is returned.

Returns ​

An empty string if the default camera is active, otherwise the NodeID of the active Camera.

Errors ​

Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE

Since ​

Version 1.0

Example ​

lua
camera = FxView.GetCamera();

SetCamera (NodeID) ​

This function activates the specified Camera. To activate the default camera, pass an empty string.

Parameters ​

  • NodeID: The NodeID of the Camera node to activate

Errors ​

Possible errors include FX_REQUIRED_ASSET_UNAVAILABLE, FX_NODE_NOT_FOUND

Since ​

Version 1.0

Example ​

lua
-- activate camera1
FxView.Set("camera1");

-- activate default camera
FxView.Set("");