Livery Editor - Controls
Action map management for the livery editor - handles input mode switching between transform, rotate, scale, and stamp modes.
Action map management for the livery editor - handles input mode switching between transform, rotate, scale, and stamp modes.
Overview
ui_liveryEditor_controls manages input action maps for different livery editing modes. It switches between cursor-based and mouse-projection-based input and provides toggles for vehicle and edit-mode action maps.
Extension path: lua/ge/extensions/ui/liveryEditor/controls.lua
Exports (M)
| Function | Signature | Description |
|---|---|---|
useMouseProjection | () | Activates mouse-projection input mode (stamp transform). |
useCursorProjection | () | Activates cursor-based input mode (transform). |
useActionMap | (actionMapKey) | Activates a specific action map, disabling all others. |
disableAllActionMaps | () | Pops all livery editor action maps. |
toggleEditActionMaps | (enable) | Enables/disables the main livery editor action map. |
enableVehicleControls | (enable) | Enables/disables vehicle input action maps. |
liveryEditor_OnUseMousePosChanged | (value) | Hook - switches input mode when mouse-pos setting changes. |
Constants
| Key | Description |
|---|---|
M.ACTION_MAPS | Map of mode names to action map object names. |
Internals
Action Map Registry
local ACTION_MAPS = {
rotate = "LiveryEditorRotate",
scale = "LiveryEditorScale",
skew = "LiveryEditorSkew",
transform = "LiveryEditorTransform",
transformStamp = "LiveryEditorTransformStamp",
material = "LiveryEditorMaterial"
}Mode Switching
useActionMap disables all action maps first, then activates the requested one. If the API is in mouse-position mode, transform is automatically upgraded to transformStamp:
M.useActionMap = function(actionMapKey)
disableAllActionMaps()
actionMapKey = actionMapKey == "transform" and api.isUseMousePos() and "transformStamp" or actionMapKey
local actionMap = ACTION_MAPS[actionMapKey]
if actionMap then
pushActionMap(actionMap)
end
endInput Modes
| Mode | Action Map | Description |
|---|---|---|
| Mouse Projection | transformStamp | Decal follows mouse position on vehicle surface |
| Cursor Projection | transform | Decal placed via cursor controls |
Vehicle Control Override
During editing, vehicle controls are disabled to prevent accidental input:
M.enableVehicleControls = function(enable)
scenetree.findObject("VehicleCommonActionMap"):setEnabled(enable)
scenetree.findObject("VehicleSpecificActionMap"):setEnabled(enable)
endHow It Works
- Livery editor starts →
disableAllActionMaps()clears input state - Edit mode activates →
useActionMap("transform")pushes appropriate map - User toggles mouse projection →
liveryEditor_OnUseMousePosChangedswitches mode - Mode change auto-selects
transformvstransformStampaction map - On deactivation, all livery action maps are popped and vehicle controls restored
Additional Exports
The following exports are available but not yet documented in detail:
M.dependenciesM.disableAllActionMapsM.editAsControllerM.liveryEditor_OnUseMousePosChangedM.toggleEditActionMapsM.toggleUseMousePosM.useCursorProjectionM.useMouseProjection