|
VR-Engage
2.3
|
Frontend UI components display simulation state and handle player interaction. VR-Engage uses Qt Quick overlays, GL Studio integration, and VR-Vantage observers/channels. Role configuration selects frontend components; an attribute write alone neither controls a camera nor changes backend simulation state.
Components can publish station-owned display values to the Player Station attribute branch. DtQtQuickOverlay copies configured values into QML properties during its tick. Reflected entity data needs a connector request before it becomes available. See Frontend Attributes and Reflected Entity Attributes for scopes and timing.
The maintained QML HUD role is data/simulationModelSets/examples/qmlHud/roles/driverOverlay.lua. It inherits the driver role and adds both the publisher and overlay:
The example plugin must register DtDriverQmlHudComponent. In examples/qmlHud/driverQmlHudComponent.cxx, the component initializes both boolean children to false in postInitialize(). Its handleSimState() filters updates by ownship ID and publishes damage appearance. The mapping reads those player-owned values; it does not publish or request them.
The corresponding file, data/UI/examples/exampleQmlHudDriver.qml, contains this data-item excerpt. Its full file also supplies animations and visual elements:
The complete QML file imports QtQuick 2.15, QtQuick.Shapes 1.0, and QtGraphicalEffects 1.15. qmlFilename is resolved through the UI loading path; it is not a repository-root path. qmlDataItemObjectName identifies a child object, not its QML id.
DtQtQuickOverlay::initialize() checks the filename, data-item name, and binding table. Its update path sets configured object properties from attribute values and invokes tick(double) when that signal/method exists. The generated attribute catalog does not enumerate every runtime or example-specific key.
The QML publisher retains a DtAttributeHandle member and initializes its children:
The complete function calls DtPlayerComponent::postInitialize() first. The header includes vrePlayerStation/playerComponent.h and vreUtil/attribute.h; the source includes vreMessages/simulationState.h and vrePlayerStation/playerStation.h. Its message subscription has matching removal in shutdown(). For new grouped subscriptions, prefer the inherited myMessageHandlers group and base shutdown. See Toolkit Fundamentals.
Use stable value types and one producer per path. Cache frequently used handles. Publishing a value does not establish a QML binding; the role's binding table and QML child properties must match. Ownship is a reflected-entity alias; lowercase ownship is a separate player subtree.
Use the role's actual DtInputLogic mapping group and action handlers. Load the input configuration before using the actions, and preserve input-logic cleanup. An invented inputMappings table is not a substitute for the maintained inputDevices/MappingGroups format. See Input and Control and its maintained input-device example.
An overlay can use the configured visibilityAttribute path. DtQtQuickOverlay connects a callback to that player attribute when the parameter is supplied. Without it, the component uses Player Station state enter/exit messages for visibility. See include/commonRoleLibraries/vreCommonComponents/qtQuickOverlay.h for supported role parameters.
GL Studio integration uses cockpit/HUD model definitions and dedicated frontend mapper components. It is not a DtGlStudioOverlay player-component API. data/simulationModelSets/VR-Engage/roles/commander.lua configures DtGlStudioHudMapperLogic under the "1 Screen Horizontal" display layout with modelDefinitions = {"GunnerSight"}.
Use include/commonRoleLibraries/vreCommonComponents/glStudioHudMapperLogic.h and the corresponding source for supported model-definition, property, and instrument-panel configuration. Transfer values through the actual mapper/instrument interface; arbitrary player attributes do not automatically bind GL Studio gauges. See the VR-Vantage GL Studio documentation for design/export requirements.
VR-Vantage observers and channels define the rendered viewpoints. VR-Engage role components configure and update those observers. DtSavedViewUpdater loads named observer records from .osrx files; look-around and sensor updater components provide additional runtime control.
A role's displayLayouts table contains named role-configuration overrides, commonly a components table. It is not a channelLayout array of normalized screen rectangles. There is no generic top-level views table with attachPoint, fieldOfView, nearClip, and farClip in the role-loading path described here.
The driver role places savedViewUpdater inside displayLayouts["1 Screen Horizontal"].components. The following excerpt preserves that structure:
The full layout also includes the dashboard overlay and look-around updater. SedanViews.osrx is a real observer-record file under that model set's roles/savedViews. Its named records include "Driver View". Attachment offsets, orientation, magnification, and other saved observer settings belong in the records, not invented role-table keys.
DtSavedViewUpdater::initialize() reads savedViews, resolves the path, loads records, and fails when no views are available. It selects initialView by the record's display name. It reads observerName, windowName, and channelName, defaulting to "Observer 1", "Window 1", and "Channel 1". These names must refer to the application's actual display configuration.
The updater also supports a list mapping view names to channel keywords:
This field is a list of {view, channelKeyword} records, not a dictionary whose keys are view names. The commander role selects M1A1AIMCommanderViews.osrx and initially uses "1 - Commander Turret". Verify that selected names exist in the saved-view file.
The Lua loader merges the selected layout into the role; the creation palette applies entity/display parameter overrides. For example, vreACV-P.entity overrides savedViewUpdater.savedViews with ACVViews.osrx and savedViewUpdater.initialView with "4 - Driver View". This permits a shared driver role with entity-specific viewpoints.
Sources: appData/scripts/loadDefinition.lua, libsrc/framework/vrePlayerStation/playerCreationPalette.cxx, include/commonRoleLibraries/vreCommonComponents/savedViewUpdater.h, and its corresponding source. See Role Configuration for merge order and entity syntax.
The driver's layout also configures DtLookAroundObserverUpdater with enableLookAround, pitchRange, yawRange, observerName, and optional supplementalSavedViewData. The per-view entries use the saved records' names. Publishing custom yaw/pitch attributes is not a camera-control API.
DtSavedViewUpdater registers MenuActionMessage and PlayerCreatedMessage handlers and uses DtSavedViewInputLogic. allowChangingViews controls whether users can change saved views. Route actions through that maintained controller; writing a custom view.mode attribute does not switch the observer without an explicit consumer.
Use registered component types and maintained UI files. Compose role components through inherits, includes, and selected display-layout overrides. A component-group filename is not a C++ component type. Component priority orders initialization; it does not eliminate dependencies or deferred readiness requirements. The QML HUD role above is a complete maintained composition example.
Keep UI ticks and message/callback work bounded. Avoid repeated path lookup and needless writes. Disconnect subscriptions and release UI resources during the component lifecycle. Use the current vreUtil/logger.h APIs for validation failures; do not log every frame. Choose readable contrast and text sizes, and check the configured display layout at its intended resolution.
See also