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

Layer Selection

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

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


Overview

ui_liveryEditor_selection tracks which layers are currently selected, computes available actions based on selection type and count, and notifies the UI of changes. It also provides duplicate and reapply workflows.

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


Exports (M)

FunctionSignatureDescription
select(layerIds, highlight)Sets the selection to one or more layer UIDs. Optionally highlights.
clearSelection()Clears all selected layers and disables highlighting.
toggleSelection(layerUid)Adds/removes a layer from the multi-selection.
addToSelection(layerUid)Adds a layer UID to the selection.
removeFromSelection(layerUid) → boolRemoves a UID; returns true if found.
getSelectedLayers() → uid[]Returns the array of selected UIDs.
getFirstSelectedLayer() → uidReturns the first selected UID.
getSelectedLayersData() → layer[]Returns UI-formatted layer objects with highlight flags.
isLayerSelected(layerUid) → boolChecks if a UID is in the selection.
getAvailableActions() → actions[]Returns context-appropriate actions for the current selection.
toggleHighlightSelectedLayer()Toggles API highlighting on the first selected layer.
duplicateSelectedLayer()Duplicates the first selected layer.
reapplySelectedLayer()Enters reapply mode - hides layer, shows cursor with its properties.
cancelReapplySelectedLayer()Cancels reapply mode and restores the layer.
setup()Clears selection and notifies UI.
notifyUiListeners()Pushes selection state, actions, and data to UI.
requestInitialData()Alias for notifyUiListeners.

Data Fields

FieldDescription
M.selectedLayersTable of currently selected layer UIDs.

Internals

Multi-Selection Action Rules

SelectionAvailable Actions
Single decalFull action set from ui_liveryEditor_layers_decal
Single fillFull action set from ui_liveryEditor_layers_fill
Single linkedSetFull action set from ui_liveryEditor_layers_group
Multiple decalsgroup, material, duplicate, mirror, visibility, delete
Multiple fillsduplicate, visibility, delete
Mixed typesvisibility only

UI Events Triggered

On any selection change, these guihooks fire:

  • liveryEditor_selection_actionsUpdated
  • liveryEditor_selection_selectedChanged
  • LiveryEditor_SelectedLayersChanged
  • LiverEditorLayerActionsUpdated
  • LiveryEditor_SelectedLayersDataUpdated

Hook Listener Exports

ExportDescription
liveryEditor_OnLayerAdded(layer) - If duplicate was active, selects the new layer.
dynamicDecals_onLayerDeleted(layerUid) - Removes deleted layer from selection.
liveryEditor_onLayersUpdated(layerUid) - Re-sends selected layer data if the updated layer is selected.

How It Works

  1. UI calls select(uid, true) when user clicks a layer - sets selection and highlights
  2. Shift-click calls toggleSelection(uid) for multi-select
  3. getAvailableActions() computes which operations are valid for the current mix
  4. Action buttons in the UI are enabled/disabled based on the returned actions
  5. Duplicate and reapply use flags (duplicateLayerActive, reapplyLayerActive) to handle async callbacks

Example Usage

local sel = extensions.ui_liveryEditor_selection

-- Select a layer with highlighting
sel.select(layerUid, true)

-- Check available actions
local actions = sel.getAvailableActions()

-- Multi-select
sel.addToSelection(anotherUid)

-- Clear
sel.clearSelection()

Additional Exports

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

  • M.addToSelection
  • M.cancelReapplySelectedLayer
  • M.clearSelection
  • M.duplicateLayerActive
  • M.duplicateSelectedLayer
  • M.dynamicDecals_onLayerDeleted
  • M.getAvailableActions
  • M.getFirstSelectedLayer
  • M.getSelectedLayers
  • M.getSelectedLayersData
  • M.isLayerSelected
  • M.liveryEditor_OnLayerAdded
  • M.liveryEditor_onLayersUpdated
  • M.notifyUiListeners
  • M.reapplyLayerActive
  • M.reapplySelectedLayer
  • M.removeFromSelection
  • M.requestInitialData
  • M.select
  • M.setup
  • M.toggleHighlightSelectedLayer
  • M.toggleSelection

See Also

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

Decal Texture Loader

Loads and categorises decal textures from the dynamic decals texture registry for the UI resource browser.

Tools

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

On this page

OverviewExports (M)Data FieldsInternalsMulti-Selection Action RulesUI Events TriggeredHook Listener ExportsHow It WorksExample UsageAdditional ExportsSee Also