RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

server/commands - Camera & Input Commandsge_utils - Game Engine Utility Functionsmain.lua - GE Lua Entry Point & Game Loopmap.lua - Navigation Graph (AI Road Map)screenshot.lua - Screenshot Systemserver/server - Level Loading & Game ServerserverConnection - Client-Server Connection Manager`setSpawnpoint` - Default Spawn Point Persistence`simTimeAuthority` - Simulation Time & Bullet Time Control`spawn` - Vehicle Spawning & Safe Placement`suspensionFrequencyTester` - Suspension Natural Frequency Analysis
ui/ambientSound - Ambient Sound Stream PlayerUI Apps ManagerUI AudioBindings LegendCamera Distance AppConsole (consoleNG)Credits MusicExternal App (WebSocket UI Server)Fade ScreenGame BlurGameplay App ContainersGrid SelectorLivery EditorMessages DebuggerMessages/Tasks App ContainersMission InfoPolice InfoTop BarUI ModsUI Navigation / MapVehicle Paint EditorVehicle Vicinity AppUI Visibility
Livery Editor - CameraLivery Editor - ControlsLivery Editor - Edit ModeLivery Editor – Editor (Core)Livery Editor – HistoryLivery Editor – Layer ActionLivery Editor – Layer EditLivery Editor – LayersLivery Editor – ResourcesLivery Editor – SelectionLivery Editor – ToolsLivery Editor – User DataLivery Editor – Utils

UI

Resources

BeamNG Game Engine Lua Cheat SheetGE Developer RecipesMCP Server Setup

// RLS.STUDIOS=true

Premium Mods for BeamNG.drive. Career systems, custom vehicles, and immersive gameplay experiences.

Index

HomeProjectsPatreon

Socials

DiscordPatreon (RLS)Patreon (Vehicles)

© 2026 RLS Studios. All rights reserved.

Modding since 2024

API ReferenceGE ExtensionsuiliveryEditor

Livery Editor - Edit Mode

Edit mode state machine for the livery editor - manages layer application, reapplication, selection, and undo within an editing session.

Edit mode state machine for the livery editor - manages layer application, reapplication, selection, and undo within an editing session.


Overview

ui_liveryEditor_editMode controls the state machine for applying, reapplying, and managing decal layers during an active livery editing session. It tracks applied layers, handles cursor properties, and provides save/cancel operations.

Extension path: lua/ge/extensions/ui/liveryEditor/editMode.lua

Note: This file is entirely commented out in the current codebase, indicating it is either deprecated, in development, or being refactored. The documented API reflects the commented implementation.


Commented API

State Fields

FieldTypeDescription
activebooleanWhether edit mode is currently active.
applyActivebooleanWhether a new decal application is pending.
reapplyActivebooleanWhether reapplying an existing layer.
allowApplybooleanWhether apply action is permitted.
activeLayerUidstringUID of the currently selected layer.
appliedLayerstableList of layer UIDs applied in this session.
isDuplicateActiveLayerbooleanFlag during layer duplication.

Core Functions

FunctionDescription
activate()Enters edit mode, pushes action map, starts apply request.
deactivate()Exits edit mode, clears state, pops action map.
apply()Applies current decal if allowed.
onApply(layer)Callback after decal application - handles continuous/single apply.
requestApply()Starts a new apply operation.
cancelRequestApply()Cancels pending apply.
requestReapply()Begins reapplying an existing layer (disables original).
cancelReapply()Cancels reapply, re-enables original layer.
saveChanges(params)Finalizes applied layers, optionally grouping them.
cancelChanges()Removes all applied layers and resets state.

Layer Management

FunctionDescription
setActiveLayer(uid)Selects a layer, updates highlighting and UI.
setActiveLayerDirection(dir)Navigates between applied layers (+1/-1).
duplicateActiveLayer()Creates a copy of the active layer.
removeAppliedLayer(uid)Removes a layer and updates applied list.
getActiveLayer()Returns the current active layer data.
toggleHighlightActive()Toggles decal highlighting on the active layer.

Internals

State Machine Flow

deactivate → activate → requestApply → apply → onApply
                                                  ↓
                                        (continuous) → cursor stays active
                                        (single)    → setActiveLayer → edit/reapply
                                                  ↓
                                        requestReapply → apply → onApply → setActiveLayer
                                                  ↓
                                        saveChanges / cancelChanges → deactivate

Continuous vs Single Apply

When api.isUseMousePos() is true (mouse projection), apply is continuous - each click adds a decal and the cursor stays active. In cursor mode, apply is single-shot and selects the new layer.

Layer Grouping

saveChanges({grouped = true}) creates a linked set and moves all applied layers into it:

local group = api.addLinkedSet()
for k, v in ipairs(M.appliedLayers) do
  api.moveLayer(lastPos, nil, index, group.uid)
end

Hooks

HookDescription
liveryEditor_OnLayerAddedTracks new layers, handles reapply replacement.
liveryEditor_onLayersUpdatedUpdates highlighting when layers change.
liveryEditor_editMode_onStateChangedBroadcasts state changes to other modules.

How It Works

  1. User enters edit mode → activate() pushes action map and starts apply
  2. Decal cursor becomes visible, user positions and clicks to apply
  3. onApply records the layer and either continues or enters selection
  4. User can reapply (modify position of existing layer) or add more
  5. saveChanges finalizes; cancelChanges removes all applied layers
  6. deactivate clears everything and restores normal mode

Additional Exports

The following exports are available but not yet documented in detail:

  • M.activate
  • M.active
  • M.activeLayerUid
  • M.allowApply
  • M.apply
  • M.applyActive
  • M.cancelChanges
  • M.cancelReapply
  • M.cancelRequestApply
  • M.deactivate
  • M.duplicateActiveLayer
  • M.editModeStateChanged
  • M.getActiveLayer
  • M.getAppliedLayersData
  • M.highlightTimer
  • M.isApplyActive
  • M.isContinuousApply
  • M.isDuplicateActiveLayer
  • M.isReapplyActive
  • M.lastLayerPosition
  • M.liveryEditor_OnLayerAdded
  • M.liveryEditor_OnLayerDeleted
  • M.liveryEditor_onLayersUpdated
  • M.onApply
  • M.onUpdate
  • M.reapplyActive
  • M.removeAppliedLayer
  • M.requestApply
  • M.requestReapply
  • M.resetCursorProperties
  • M.saveChanges
  • M.setActive
  • M.setActiveLayer
  • M.setActiveLayerDirection
  • M.setAllowApply
  • M.setAppliedLayers
  • M.setApplyActive
  • M.setReapplyActive
  • M.setup
  • M.toggleHighlightActive
  • M.toggleRequestApply

Livery Editor - Controls

Action map management for the livery editor - handles input mode switching between transform, rotate, scale, and stamp modes.

Livery Editor – Editor (Core)

Core entry point and API interface for the livery editor UI. Manages editor lifecycle (setup, session, save, exit).

On this page

OverviewCommented APIState FieldsCore FunctionsLayer ManagementInternalsState Machine FlowContinuous vs Single ApplyLayer GroupingHooksHow It WorksAdditional Exports