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 – Tools

Central tool manager - switches active tools, manages action maps, and dispatches operations to cursor or layer targets.

Central tool manager - switches active tools, manages action maps, and dispatches operations to cursor or layer targets.


Overview

ui_liveryEditor_tools manages which editing tool is active (transform, deform, material, mirror) and provides doOperation, the universal dispatch function that routes an operation to either the cursor (new decal) or selected layer(s).

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


Exports (M)

FunctionSignatureDescription
useTool(tool)Activates a tool and its action map. Triggers LiveryEditorToolChanged.
closeCurrentTool()Deactivates all action maps and clears the current tool.
getCurrentTool() → stringReturns the current tool name.
applyChanges()Stamps the cursor as a new decal via api.addDecal().
doOperation(funcOperation, ...)Dispatches an operation function to the appropriate target(s).
liveryEditor_editMode_onStateChanged(data)Hook - responds to edit mode state changes.

Internals

Tool Constants

M.TOOLS = {
  transform = "transform",
  deform    = "deform",
  material  = "material",
  mirror    = "mirror"
}

doOperation Dispatch Logic

doOperation(fn, ...) is the core routing mechanism used by all tool modules:

  1. Edit mode active + reapply/apply → calls fn(nil, ...) (operates on cursor)
  2. Edit mode active + layer selected → calls fn(layer, ...) (operates on the active layer)
  3. No edit mode → iterates all selected layers and calls fn(layer, ...) on each
M.doOperation = function(funcOperation, ...)
  if M.editModeState.active then
    if M.editModeState.reapplyActive or M.editModeState.applyActive then
      funcOperation(nil, ...)  -- cursor mode
    else
      local layer = api.getLayerByUid(M.editModeState.activeLayerUid)
      funcOperation(layer, ...)
    end
  else
    local selectedLayerUids = uiSelectionApi.getSelectedLayers()
    if selectedLayerUids then
      for _, layerUid in ipairs(selectedLayerUids) do
        funcOperation(api.getLayerByUid(layerUid), ...)
      end
    end
  end
end

Edit Mode State

Synced from ui_liveryEditor_editMode via hook:

M.editModeState = {
  active = nil,            -- edit mode is active
  reapplyActive = nil,     -- reapply (stamp) mode
  applyActive = nil,       -- apply (new decal) mode
  activeLayer = nil,       -- currently edited layer
  activeLayerUid = nil     -- UID of the active layer
}

How It Works

  1. The UI calls useTool("transform") to switch tools
  2. The appropriate action map is pushed via ui_liveryEditor_controls
  3. Tool-specific modules (transform, material, etc.) call doOperation(fn, ...) for their actions
  4. doOperation routes to cursor or layer based on the current edit mode state
  5. closeCurrentTool() pops all action maps when the tool panel is closed

Example Usage

local tools = extensions.ui_liveryEditor_tools

-- Activate transform tool
tools.useTool("transform")

-- Dispatch a custom operation to selected layers
tools.doOperation(function(layer, value)
  if layer then
    layer.metallicIntensity = value
    api.setLayer(layer, true)
  end
end, 0.5)

-- Close tool
tools.closeCurrentTool()

Additional Exports

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

  • M.applyChanges
  • M.closeCurrentTool
  • M.getCurrentTool
  • M.liveryEditor_editMode_onStateChanged
  • M.useTool

Livery Editor – Selection

Manages the layer selection state - single/multi-select, available actions, highlight toggling, and UI notifications.

Livery Editor – User Data

Manages livery save files - listing, creating, renaming, and deleting `.dynDecals.json` files.

On this page

OverviewExports (M)InternalsTool ConstantsdoOperation Dispatch LogicEdit Mode StateHow It WorksExample UsageAdditional Exports