VisualContext
- Last UpdatedFeb 19, 2025
- 3 minute read
The VisualContext node makes it possible to handle different visual aspects of models in the scene on any viewport at runtime.
At startup, the XR engine creates Visual Context nodes for each one defined in the RenderSetup XML. If any Viewport featuring a scene layer without specifying a visual context name is present, a default visual context is created, and reused for any Viewport of this type encountered.
Users can always create other viewports at parse time or runtime—either by defining them in scripts or by using a createnode statement in a command or coroutine. If a VisualContext is deleted using a deletenode statement, all Viewports using it will switch their current VisualContext to the first available.
The maximum allowed number of Visual Context in a scene is 31.
Note: SGL does not support Visual contexts or multiple viewports. SGL content will be visible only on a viewport with the same size as the graphic context, and all the visual changes are applied on it regardless of the specified Visual Context.
Deleting the only VisualContext
A mechanism to prevent the session from running without a VisualContext node is in place.
Deleting the only available VisualContext will result in the following things happening:
-
An error in the log.
-
The deletion of that VisualContext, and
-
The creation of a new VisualContext with a random name.
Platform support
This node is fully supported on XR-Windows platform, XR-Portable Windows, XR-Portable iOS, XR-Portable Android, and XR-P Hololens platforms.
|
XR-WIN |
XR-P-WIN |
XR-P-IOS |
XR-P-AND |
XR-P-WASM |
|---|---|---|---|---|
|
Full support |
Full support |
Full support |
Full support |
Full support |
|
|
|
|
|
|
VisualContext fields
These are the fields for VisualContext node. Only the node-specific fields are indicated, not fields obtained by inheritance.
Field inheritance: NodeBase > VisualContext
|
Fields |
Type |
Use |
Default value |
Description |
|---|---|---|---|---|
|
resetContext |
sfunction |
Optional |
When called, this field will reset the visual state of the models in the scene to the state they had at load time. |