RLS Studios
ProjectsPatreonCommunityDocsAbout
Join Patreon
BeamNG Modding Docs

Guides

Reference

Server CommandsGE UtilitiesGame Engine MainNavigation GraphScreenshot CaptureServerServer ConnectionSpawnpoint ManagerSimulation TimeVehicle SpawningSuspension Frequency Tester
Ambient SoundUI Apps ManagerUI AudioBindings LegendCamera Distance AppDeveloper ConsoleCredits MusicExternal WebSocket ServerFade ScreenGame BlurGameplay App ContainersGrid SelectorLivery EditorMessages DebuggerMessages/Tasks App ContainersMission InfoPolice InfoTop BarUI ModsNavigation Map DataVehicle Paint EditorVehicle Vicinity AppUI Visibility
Camera ManagementAction Map ManagementEdit Mode State MachineLivery EditorUndo/Redo WrapperLayer ActionsLayer Edit LifecycleLayer DataDecal Texture LoaderLayer SelectionToolsLivery FilesMath Utilities

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

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

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


Overview

ui_liveryEditor_editor orchestrates the livery editor: initialising the dynamic decals API, toggling vehicle controls, loading/saving skin files, and cleaning up on exit. It acts as the bridge between the UI layer and editor_api_dynamicDecals.

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


Dependencies

editor_api_dynamicDecals, ui_liveryEditor_layers, ui_liveryEditor_layers_decals, ui_liveryEditor_layers_cursor, ui_liveryEditor_camera, ui_liveryEditor_controls, ui_liveryEditor_resources, ui_liveryEditor_selection, ui_liveryEditor_tools, ui_liveryEditor_tools_transform, ui_liveryEditor_editMode


Exports (M)

FunctionSignatureDescription
setup()Initial API setup, switches skin to "dynamicTextures", disables vehicle controls.
startEditor()Full editor initialisation (API, resources, edit mode, controls).
startSession()Begins an editing session - loads a file or creates a new layer stack.
createNew()Resets state so the next session starts with a blank canvas.
loadFile(file) → boolValidates and queues a .dynDecals.json file for the next session.
save(filename)Exports the current skin and persists the layer stack to disk.
applySkin()Applies the saved skin name via core_vehicle_partmgmt.setSkin.
exitEditor()Clears the layer stack, re-enables vehicle controls, resets state.
onUpdate()Per-frame tick - forwards to api.onUpdate_() while the editor is running.

Data Fields

FieldDescription
M.dependencies{"editor_api_dynamicDecals", "ui_liveryEditor_layers", "ui_liveryEditor_layers_decals", ...} - decal API and layer subsystems.

Internals

Vehicle Controls Toggle

local function toggleVehicleControls(enable)
  local commonActionMap = scenetree.findObject("VehicleCommonActionMap")
  if commonActionMap then commonActionMap:setEnabled(enable) end
  local specificActionMap = scenetree.findObject("VehicleSpecificActionMap")
  if specificActionMap then specificActionMap:setEnabled(enable) end
end

Disables driving inputs while the editor is active, re-enables on exit.

Session Flow

  1. startEditor() - one-time setup (API, resources, edit mode, action maps)
  2. startSession() - either loads a queued file or creates a new stack with a fill layer using the vehicle's paint colour
  3. User edits layers via other livery editor extensions
  4. save(filename) - exports skin + saves .dynDecals.json
  5. applySkin() - optionally applies the skin so it persists after exiting
  6. exitEditor() - tears everything down, restores vehicle controls

Save Filename Pattern

Only alphanumeric, dash, and underscore characters are accepted: ^[a-zA-Z0-9_-]+$


How It Works

  1. The editor disables vehicle action maps and the API's own update loop on start
  2. A fill layer matching the vehicle colour is added as the base when creating new
  3. Saving exports the skin via api.exportSkin() and writes a layer stack JSON file
  4. On exit without applying, the skin resets to nil (default); with apply, the named skin stays

Example Usage

-- Start the editor
extensions.ui_liveryEditor_editor.startEditor()

-- Load an existing save
extensions.ui_liveryEditor_editor.loadFile("settings/dynamicDecals/mySkin.dynDecals.json")
extensions.ui_liveryEditor_editor.startSession()

-- Save and apply
extensions.ui_liveryEditor_editor.save("mySkin")
extensions.ui_liveryEditor_editor.applySkin()

-- Exit
extensions.ui_liveryEditor_editor.exitEditor()

Additional Exports

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

  • M.applySkin
  • M.createNew
  • M.exitEditor
  • M.loadFile
  • M.onUpdate
  • M.save
  • M.setup
  • M.startEditor
  • M.startSession

See Also

  • Livery Editor - Camera - Related reference
  • Livery Editor - Controls - Related reference
  • Livery Editor - Edit Mode - Related reference
  • UI System Guide - Guide

Edit Mode State Machine

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

Undo/Redo Wrapper

Thin wrapper around the dynamic decals API undo/redo system that notifies the UI on history changes.

On this page

OverviewDependenciesExports (M)Data FieldsInternalsVehicle Controls ToggleSession FlowSave Filename PatternHow It WorksExample UsageAdditional ExportsSee Also