Livery Editor – Layer Action
Dispatches high-level actions (reproject, transform, delete, duplicate, mirror, etc.) on the currently selected layer(s).
Dispatches high-level actions (reproject, transform, delete, duplicate, mirror, etc.) on the currently selected layer(s).
Overview
ui_liveryEditor_layerAction defines an action-dispatch system for the livery editor. The UI sends an action string and this module routes it to the appropriate operation on the selected layer.
Extension path: lua/ge/extensions/ui/liveryEditor/layerAction.lua
Exports (M)
| Function | Signature | Description |
|---|---|---|
performAction | (action) → varies | Dispatches the named action on the current selection. Returns action-specific data. |
toggleEnabledByLayerUid | (layerUid) | Toggles a layer's enabled flag directly by UID. |
Action Types
| Action | Description |
|---|---|
requestReproject | Shows the cursor with the selected layer's properties for repositioning. |
cancelReproject | Restores the layer and hides the cursor. |
reproject | Stamps the cursor position as the new layer position. |
transform | Opens the layer transform view for position/scale/rotation editing. |
materials | Opens the materials view for colour/metallic/roughness editing. |
highlight | Toggles decal highlighting on the selected layer. Returns bool. |
enabled | Toggles enabled state on all selected layers. Returns bool. |
delete | Removes the selected layer from the stack. |
duplicate | Duplicates the selected layer. |
mirror | Toggles the mirrored flag. Returns bool. |
flipMirrored | Toggles flip on the mirrored decal. Returns bool. |
Internals
Reproject Flow
requestReproject- copies layer properties to the cursor, hides the layer, shows the cursor- User repositions the cursor on the vehicle
reproject- stamps a new decal, overwrites the original layer UID, removes the temporary
Mouse vs Cursor
Helper functions useMouse() / useCursor() toggle api.settingsFlags.UseMousePos to switch between mouse-driven and keyboard/controller-driven cursor placement.
How It Works
- The UI calls
performAction("transform")(or any action string) - The module reads the first selected layer from
ui_liveryEditor_selection - Fetches the full layer data from the API
- Routes to the corresponding internal function
- Returns a value where applicable (booleans for toggles)
Example Usage
local layerAction = extensions.ui_liveryEditor_layerAction
-- Delete the selected layer
layerAction.performAction("delete")
-- Toggle mirror and check result
local mirrored = layerAction.performAction("mirror")
-- Toggle enabled directly
layerAction.toggleEnabledByLayerUid(someLayerUid)Additional Exports
The following exports are available but not yet documented in detail:
M.performActionM.toggleEnabledByLayerUid
Livery Editor – History
Thin wrapper around the dynamic decals API undo/redo system that notifies the UI on history changes.
Livery Editor – Layer Edit
Manages the full edit lifecycle for a single decal layer - transform (translate, rotate, scale, skew), material properties, and gamepad/controller hold-repeat input.