API ReferenceGE Extensionsui
Vehicle Paint Editor
ImGui tool for editing metallic paint properties on the player vehicle.
ImGui tool for editing metallic paint properties on the player vehicle.
Overview
ui_vehiclePaint provides a simple ImGui window with sliders for adjusting metallic paint data (roughness, metallic, coat, coat roughness) on paint slots 0–2 of the player vehicle.
Extension path: lua/ge/extensions/ui/vehiclePaint.lua
Dependencies: ui_imgui
Exports (M)
| Function | Signature | Description |
|---|---|---|
show | () | Opens the paint editor window. |
onUpdate | () | Draws the ImGui window each frame. |
onExtensionLoaded | () | Initializes imgui pointers. |
changeData | (value, index) | Programmatically changes a paint property on slot 0. |
Data Fields
| Field | Description |
|---|---|
M.dependencies | {"ui_imgui"} - required for ImGui paint editor. |
Internals
Paint Data Format
Each paint slot stores 4 floats as a space-separated string in metallicPaintData:
"roughness metallic coat coatRoughness"- Index 1: Roughness
- Index 2: Metallic
- Index 3: Coat
- Index 4: Coat Roughness
UI Layout
Three collapsible sections (Paint 0, 1, 2), each with four sliders (0–1 range). Changes are applied immediately via veh:setField('metallicPaintData', slotIndex, dataString).
Helpers
dataToString(data)- Converts{r, m, c, cr}→"r m c cr"string.stringToData(str)- Parses space-separated string → number array.sliderUI(id, array, index)- Renders a slider and setsneedUpdateflag.updateData(veh, index)- Applies data to vehicle if changed.
How It Works
- Call
extensions.ui_vehiclePaint.show()to open the window. - Each frame,
onUpdatereads currentmetallicPaintDatafrom the vehicle. - Sliders modify the local
datatable; on change,needUpdateis set. updateDatawrites the modified string back to the vehicle field.
Lua Examples
-- Open the paint editor
extensions.ui_vehiclePaint.show()
-- Programmatically set metallic value on paint slot 0
extensions.ui_vehiclePaint.changeData(0.8, 2) -- index 2 = metallicAdditional Exports
The following exports are available but not yet documented in detail:
M.changeDataM.onExtensionLoadedM.onUpdateM.show