Livery Editor – Layers / Cursor
Manages the decal placement cursor - position, scale, skew, rotation, colour, material properties, and mirror settings.
Manages the decal placement cursor - position, scale, skew, rotation, colour, material properties, and mirror settings.
Overview
ui_liveryEditor_layers_cursor controls the "cursor" used to preview and place new decals. It wraps the dynamic decals API cursor/decal properties and notifies the UI of changes. It also provides default values and a reset mechanism.
Extension path: lua/ge/extensions/ui/liveryEditor/layers/cursor.lua
Exports (M)
| Function | Signature | Description |
|---|---|---|
translate | (steps_x, steps_y) | Moves cursor position by step increments. |
setPosition | (posX, posY) | Sets cursor position absolutely. |
scale | (steps_x, steps_y) | Adjusts cursor scale by steps. |
setScale | (scaleX, scaleY) | Sets cursor scale absolutely. |
skew | (steps_x, steps_y) | Adjusts cursor skew by steps. |
setSkew | (skewX, skewY) | Sets cursor skew absolutely. |
rotate | (degrees, counterClockwise) | Rotates cursor by degree steps. |
setRotation | (degrees) | Sets cursor rotation absolutely. |
setColor | (color) | Sets RGBA colour array on the cursor. |
setMetallicIntensity | (value) | Sets metallic intensity (0–1). |
setRoughnessIntensity | (value) | Sets roughness intensity (0–1). |
setMirrored | (mirrored, flipped) | Sets mirror and flip flags. |
setMirrorOffset | (offset) | Sets the mirror offset distance. |
setUseMousePos | (value) | Toggles mouse-driven vs cursor-driven placement. |
setProjectSurfaceNormal | (value) | Toggles projecting along the surface normal. |
setDecal | (texture) | Sets the colour texture path. Ensures alpha > 0. |
setCursorProperties | (params) | Bulk-sets cursor properties from a params table. |
resetProperties | (params) | Resets specific or all properties to defaults. |
getData | () → table | Returns the full cursor state as a UI-friendly table. |
requestData | () | Triggers LiveryEditor_CursorUpdated with current data. |
notifyListeners | () | Alias for requestData - fires LiveryEditor_CursorUpdated. |
Exported Constants
| Constant | Value | Description |
|---|---|---|
DEFAULT_POSITION | Point2F(0.5, 0.5) | Default cursor position (center). |
DEFAULT_SCALE | vec3(0.5, 1, 0.5) | Default cursor scale. |
DEFAULT_SKEW | Point2F(0, 0) | Default cursor skew. |
DEFAULT_ROTATION | 0 | Default rotation in degrees. |
DEFAULT_COLOR | Point4F(1, 1, 1, 1) | Default colour (white, full alpha). |
DEFAULT_METALLICINTENSITY | 0 | Default metallic intensity. |
DEFAULT_ROUGHNESSINTENSITY | 0 | Default roughness intensity. |
DEFAULT_MIRRORED | false | Default mirror state. |
DEFAULT_FLIP_MIRRORED | false | Default flip-mirror state. |
DEFAULT_MIRROR_OFFSET | 0 | Default mirror offset. |
Internals
Step Units
TRANSLATE_STEP_UNIT = 0.001
ROTATE_STEP_UNIT = 0.1
SCALE_STEP_UNIT = 0.01
SKEW_STEP_UNIT = 0.01Default Values
DEFAULT_POSITION = Point2F(0.5, 0.5)
DEFAULT_SCALE = vec3(0.5, 1, 0.5)
DEFAULT_SKEW = Point2F(0, 0)
DEFAULT_ROTATION = 0
DEFAULT_COLOR = Point4F(1, 1, 1, 1)
DEFAULT_METALLICINTENSITY = 0
DEFAULT_ROUGHNESSINTENSITY = 0
DEFAULT_MIRRORED = false
DEFAULT_FLIP_MIRRORED = false
DEFAULT_MIRROR_OFFSET = 0Reset Params
resetProperties accepts an optional array of property names: "position", "scale", "skew", "rotation", "color", "metallicIntensity", "roughnessIntensity", "material" (resets color + metallic + roughness), "mirror", "transform" (alias for position).
How It Works
- Every setter wraps the corresponding
api.set*call - After each change,
notifyListeners()triggersLiveryEditor_CursorUpdatedwith the full cursor data - The UI reads position, scale, rotation, colour, etc. from the triggered data
resetProperties()restores defaults selectively or globally
Example Usage
local cursor = extensions.ui_liveryEditor_layers_cursor
-- Set a decal texture and position
cursor.setDecal("/art/decals/logo.png")
cursor.setPosition(0.5, 0.5)
cursor.setScale(0.3, 0.3)
cursor.setColor({1, 0, 0, 1}) -- red
-- Reset everything
cursor.resetProperties()Additional Exports
The following exports are available but not yet documented in detail:
M.DEFAULT_COLORM.DEFAULT_FLIP_MIRROREDM.DEFAULT_METALLICINTENSITYM.DEFAULT_MIRROREDM.DEFAULT_MIRROR_OFFSETM.DEFAULT_POSITIONM.DEFAULT_ROTATIONM.DEFAULT_ROUGHNESSINTENSITYM.DEFAULT_SCALEM.DEFAULT_SKEWM.getDataM.notifyListenersM.requestDataM.resetPropertiesM.rotateM.scaleM.setColorM.setCursorPropertiesM.setDecalM.setMetallicIntensityM.setMirrorOffsetM.setMirroredM.setPositionM.setProjectSurfaceNormalM.setRotationM.setRoughnessIntensityM.setScaleM.setSkewM.setUseMousePosM.skewM.translate