Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

AVEVA™ XR Studio

Global

  • Last UpdatedSep 26, 2025
  • 10 minute read

The Global node defines scene attributes, and contains all the MWX that must be always visible, independent of the context.

  • There must be always one and only one global node in the script for a scene or application.

  • Being always active, the global context is the node that handles mouse and keyboard events.

Platform support

This node is fully supported on XR-Windows platform.

It is partially supported on XR-Portable Windows, XR-Portable iOS, XR-Portable Android, and XR-P WASM platforms.

The portable platforms have a deeply different context management, so only a reduced subset of Global fields are supported on the portable platforms.

XR-WIN

XR-P-WIN

XR-P-IOS

XR-P-AND

XR-P-WASM

Full support

Partial support

Partial support

Partial support

Partial support

Full support

Limited support

Limited support

Limited support

Limited support

Text input settings

The text input parameters enable you to modify the characteristics of text typing. They are shared by several input nodes.

Runtime language switch

You can use the global node to switch the language at runtime. The lang field requests an immediately update of all text content to reflect the newly-selected language.

Specify the desired language

  • On the lang field, set the corresponding 2-digit language code in lower case. For example, "it" to switch to Italian.

<global name="global" lang="it">

If a wrong code or an unsupported language is specified, an error is returned in the log.

Capturing snapshots

The global node offers two ways to capture snapshots from the engine.

  • Capturing screen

  • Capturing from camera

Capturing screen

With the captureScreen method, it is possible to capture a snapshot image of the rendering form and save it locally to the AVEVA XR application folder with an automatic progressive name. It's the exact same functionality provided by the Graphics tab of the XR Viewer Runtime Debug Tool.

When rendering on the screen, the capture is set to the same resolution of the window. When using a VR device, such as Oculus or OpenVR, the capture is set to the resolution of the device rather than the resolution of the window.

Capturing from camera

Using the captureCamera method, it is possible to create a snapshot from any camera present in the scene using the camera settings like far, near, fov, projectionMode, and so on.

The captureCamera is an MSTRING field and requires four comma-separated parameters.

For example: cam_01,1920,1080,capture.tga.

Parameter

Description

camera name

The name of the camera node to use to generate the snapshot.

width

The horizontal size of the snapshot.

height

The vertical size of the snapshot.

filepath

The file path of the saved image starting from application root. It must be set with a .tga,.bmp,.gif,.jpeg,.png, or .tiff extension.

Notes

  • The snapshot will include the default 2D layer regardless of which camera is used—even on a multi-viewport project with viewports that do not display the main user interface. This may lead to the unexpected presence of UI elements on a screenshot taken from a camera used by viewports that do not display 2D elements in the render. For details on Viewport concepts, please see Viewports .

  • Using a different aspect ratio compared to the application form, will produce the same effect as form resize on both 2D and 3D content.

Using clipboard to import and export text

The Global node allows the import and export of text into the XR application using the system clipboard.

Write to clipboard

  • Copy the text from the variable (global/local) and set to the system clipboard.

Examples

For global variable: <set name="global.writeToClipboard" value="variablestr.value" />

For local variable: <set name="global.writeToClipboard" value="%strwrite%" />

Read from clipboard

  • Read the text from the system clipboard and set to the variable (global/local).

Examples

For global variable: <set name="global.readFromClipboard" value="variablestr.value" />

For local variable: <set name="global.readFromClipboard" value="%strread%" />

Access profile values

You can use the sfunction field name getProfilerValue to access engine internal profiler values and use them for any valuable reason, such as logging or adapting content.

Example: [@global.getProfilerValue.execute(logic.gameFPS)] returns the current FPS performance.

See the debug Render Stats panel for a list of supported profiler information. Note that names are always dot (‘.’) separated.

Note: Most profiler values are updated by the system only when the application is in Debug mode.

As the getProfilerValue call requires a process to acquire the data that can have a significant cost, it should be avoided to call it frequently.

If you are interested just in sampling FPS values a more performing alternative is represented by the getPerformanceData sfunction.

Example: [@global.getPerformanceData.execute(gameFPS)] returns the current FPS performance.

Code example

This is a code example for the Global node.

<Global name="global" startup="set_logo" gridWidth="1920" gridHeight="1080" separation="15" lang="it" >

Position

The global node must be inside the root node <ft>.

Global fields

These are the fields for Global node. Only the node-specific fields are indicated, not fields obtained by inheritance.

Field inheritance: NodeBase > Context > Scene > Global

Fields

Type

Use

Default value

Description

activeContexts

sstring

Read only

Global

Comma-separated string of current active contexts, including <global>. Can be used for conditional code.

camera

sstring

Optional

Not set

The initial camera of the context. Must contain the name of a Camera node.

captureCamera

mstring

Optional

Not set

Creates a snapshot from any camera in the scene using camera settings. It requires four parameters:

1. camera node name

2. horizontal resolution

3. vertical resolution

4. snapshot filepath with filepath extension set to .tga,.bmp,.gif,.jpeg,.png, or.tiff.

captureScreen

sevent

Optional

Not set

Performs a screen capture and saves it to the application folder as TGA.

commandLine

mstring

Read only

Not set

The command line parameters passed to the application at start.

connections

dstring

Read only

Internally calculated

Contains the name of all local connections and their state (connected, not connected). On a server instance, the dictionary will contain all connected instances (keys) and their connection state (values). On a client, the dictionary will show the client name (key) and its connection state (value) if connected or empty, if not connected.

convergence

sfloat

Optional

Not set

Stereo convergence value. By default, keeps driver default value.

currentCamera

sstring

Read only

Internally calculated

Returns the name of the currently displayed camera in the DEFAULT_VIEWPORT. DEFAULT_SCENE_LAYER render layer.

cursorRate

sfloat

Optional

Not set

The blinking interval of the caret position indicator.

fluidStart

sstring

Optional

Not set

Starts a fluid animation. Must be set to the name of the <fluid> object to start.

fluidStop

sstring

Optional

No default value

Stops a fluid animation. Must be set to the name of the <fluid> object to stop.

fluidPause

sstring

Optional

Not set

Pauses a fluid animation. Must be set to the name of the <fluid> object to pause.

getPerformanceData

sfunction

Optional

Returns the value of a profiled parameter. Only renderFPS and gameFPS values are supported.

SSTRING getPerformanceData(SSTRING performanceParamName)

getProfilerValue

sfunction

Optional

Returns the value of a profiled parameter. For list of available parameters, see Render Stats panel of Debug Panel. For example, logic.gameLoop.syncPerFrame.

SSTRING getProfilerValue(SSTRING profilerParamName)

getScreenPosition

sfunction

Optional

Returns the screen coordinates for a given scene 3D position.

SVEC2 getScreenPosition.execute (SVEC3 3DPos)

getTextRectSize

sfunction

Optional

Returns the size of the rectangle needed to render text using the given font.

Input (JSON)

  • Text: The text to measure.

  • Font: Font settings (such as family, size).

  • MaximumWidth (optional): Wraps text, if provided.

Output

  • Without MaximumWidth: Exact width and height of text in one line.

  • With MaximumWidth: Fixed width, height adjusted for wrapped text.

Example: {"Text":"OOOOOO","Font":{"Family":"Arial","Style":"Bold|Italic|antialias","Size":20},"MaximumWidth":100}

gridWidth

sfloat

Optional

1

Screen grid width. This is used for displaying 2D content and getting mouse events.

gridHeight

sfloat

Optional

1

Screen grid height. This is used for displaying 2D content and getting mouse events.

gridRect

svec4

Optional

0 0 1 1

Changes the 2D element aspect ratio. For example, to adapt for a VR visor. Can be used only at loading time with a patch.

headWorldMatrix

smatrix

Read only

Internally calculated

Returns the matrix for current head, such as current camera, Oculus/Vive, or Hololens. This refers to DEFAULT_VIEWPORT. DEFAULT_SCENE_LAYER render layer

isActive

sbool

Read only

true

Global context is always active.

isOver2DInterface

sfunction

Optional

Checks if the mouse is over a 2D interface. It accepts the following values:

  • RectBase2D: Returns true if the mouse is over a RectBase2D node with propagateEvent set to false.

  • Hotspot: Returns true if the mouse is over a Hotspot of mode2D type.

  • Any value including empty string: Returns true if any of the above conditions are verified.

Note: It only considers 2D elements drawn on the 2D overlay layer. It does not consider RectBase2D elements drawn on textures displayed in the scene or mode3D hotspots.

SBOOL isOver2DInterface(SSTRING interfaceType)

keyDown

sstring

Read only

Not set

The value changes when a key is pressed.

keyInputEnable

sbool

Optional

true

Enables or disables input from the keyboard.

keyUp

sstring

Optional

0.7

The value changes when a key is released.

mouseCoordinateSystem

senum

Optional

screen

Changes how the mouse position is internally calculated.

  • screen: The position is relative to the whole container panel.

  • defaultViewport: The position is calculated relatively to the default viewport. This option can be used to enable 2D interaction in multi-viewport applications.

mouseCursor

senum

Optional

default (Arrow)

Shows the mouse cursor with selected option.

mouseDown

sevent

Read only

Not set

Becomes true on mouse down.

mouseInputEnable

sbool

Optional

true

Enables or disables input from the mouse.

mouseLock

sbool

Optional

false

When set to true:

  • The mouse cursor is locked in place to prevent it from moving.

  • The mousePosition and mousePositionUnit fields will stop getting updated by the physical mouse movement.

  • DragSensors will stop getting updated by the physical mouse movement, unless the DragSensor.useVirtualMouse parameter is set to true.

mousePosition

svec2

Read only

Not set

The current mouse position on Application panel.

mousePositionUnit

svec2

Read only

Not set

The current mouse position normalized 0-1 on Application panel.

mouseUp

sevent

Read only

Not set

Becomes true on mouse up.

mouseVirtualPosition

svec2

Read only

Not set

When mouseLock is set to false, this field always contains the same value as mousePosition.

When mouseLock is set to true, this field contains a virtual coordinate representing the coordinate the cursor would have if it was allowed to move.

mouseVirtualPositionUnit

svec2

Read only

Not set

The current mouseVirtualPosition normalized 0-1 on Application panel.

mouseVisible

sbool

Optional

true

Shows and hides the mouse cursor. This field is available only when Graphics.window.showCursor is set to true in the Application Configuration File. See Graphics parameters.

onEnter

sevent

Optional

Not set

Event is triggered when the context becomes active.

onExit

sevent

Optional

Not set

Event is triggered when the context exits from active state. This means that another context is becoming active.

pixelSquare

sbool

Optional

true

The false value not supported yet.

readFromClipboard

sfunction

Optional

Not set

Read the OS Clipboard text and set to node field or local variable.

readFromClipboard.execute(DESTFIELD)

renderEnable

sbool

Optional

true

If disabled, the 3D rendering will not be executed. This field has the same behavior as the Render Enable control in the Debug panel.

repeatDelay

sfloat

Optional

0.1

Defines the interval in seconds before repeating the currently pressed key.

repeatRate

sfloat

Optional

0.3

Defines the typing interval for a key during repeat.

requestStateZero

sfunction

Optional

Not set

Calling this sfunction from a MessageBus instance will request the statezero, so that all shared fields get synched in the MessageBus state kept by the server.

screenHeight

sfloat

Read only

Internally calculated

DEFAULT_VIEWPORT current screen actual height, in pixels.

screenWidth

sfloat

Read only

Internally calculated

DEFAULT_VIEWPORT current screen actual width, in pixels.

screenResized

sevent

Optional

Not set

Event is triggered when the screen is resized. Event is triggered even if the render is disabled.

screensScale

mfloat

Optional

1

Defines the scales of all the monitors attached to the device (WIN only)

sceneCameras

msstring

Read only

Internally calculated

Contains the name of all the camera defined inside the scripts.

separation

sfloat

Optional

Not set

Stereo separation value. By default, keeps driver default value.

setKeyDown

sstring

Optional

Not set

Forces key down event.

setKeyUp

sstring

Optional

Not set

Forces key up event.

setMouseDown

sevent

Optional

Not set

Forces mouse down event.

setMousePositionUnit

svec2

Optional

Not set

Forces mouse position with normalized 0-1 coordinates.

setMouseUp

sevent

Optional

Not set

Forces mouse up event.

startup

sstring

Optional

Not set

The name of the Context node to set as active at scene startup.

transparencyMode

sstring

Optional

Engine transparency default

The transparency mode. There are three possible values: None, ObjSort, TriSort.

type

sstring

Optional

static

The engine supports only static context loading.

userAppCloseInvoked

sevent

Optional

Not set

The event is enabled only if the Scene.preventDefaultAppClosing parameter is set to true.

The event is triggered when the the user triggers a shutdown intent by trying to close an app by clicking the window close button, clicking the windows bar context menu close button, or using the Alt+F4 shortcut.

viewerMaximize

sstring

Optional

Not set

Set the viewer to the maximize dimension in the current screen. Depending on the value set for config item Graphics.window.windowResizeMode this functionality behavior may be different or forbidden.

viewerMinimize

sstring

Optional

Not set

Minimize the viewer to an icon in the taskbar .Depending on the value set for config item Graphics.window.windowResizeMode this functionality behavior may be different or forbidden.

viewerSetSize

sfunction

Optional

Not set

Set the size of the viewer window to a specified dimension. Depending on the value set for config item Graphics.window.windowResizeMode this functionality behavior may be different or forbidden.

viewportList

mstring

Optional

Not set

On application start, the viewportList field populates with the list of viewport names that are created in the scene.

volume

sfloat

Optional

1

Sets the application audio volume in the [0 1] range.

volumeMute

sbool

Optional

false

Mutes the audio.

writeToClipboard

sfunction

Optional

Not set

Copy the text from node field or local variable to system clipboard.

writeToClipboard.execute(SOURCEFIELD)

In This Topic
Related Links
TitleResults for “How to create a CRG?”Also Available in