Context
- Last UpdatedMay 27, 2024
- 3 minute read
The 3D scene is made up by one Global (context) and zero, one, or more Context node <context>. Contexts are optional; however, the global context is mandatory.
-
Each context can contain one or more <mwx>.
-
There can be only one active context at a time (plus the always-active Global context).
-
When a context is active, its MWX files are visible. When a context is not active, its MWX files are not visible.
-
All the content of all the context nodes MWX included always loads into memory. Therefore, each node defined inside a context is always active, including routing.
Platform support
This element is fully supported on XR-Windows, XR-Portable Windows, XR-Portable iOS, XR-Portable Android, and XR-P WASM 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 |
|
|
|
|
|
|
Code example
This is a code example for the Context node.
<Context name="set_dpi" camera="Camera02">
Position
The Context node must be inside the root node <ft>.
Context Fields
These are the fields for Context node. Only the node-specific fields are indicated, not fields obtained by inheritance.
Field inheritance: NodeBase > Context
|
Fields |
Type |
Use |
Default value |
Description |
|---|---|---|---|---|
|
camera |
sstring |
Optional |
Not set |
The initial camera of the context. Must contain the name of a Camera node. |
|
isActive |
sbool |
Read only |
Internally calculated |
Becomes true when the context is active. |
|
mode |
sstring |
Optional |
Static |
The XR engine currently supports only static context loading. This field must be kept, because it is not defined in the XML. |
|
onEnter |
sevent |
Optional |
Event is triggered when the context becomes active. |
|
|
onExit |
sevent |
Optional |
Event is triggered when the context exits from active state. This means that another context is becoming active. |
|
|
requestActive |
sbool |
Optional |
Not set |
Can be used to request the context to become active/not active. |
|
type |
senum |
Read only |
Internally calculated |
Set to sector for context node instances. Set to to scene for scene and global. |