Livery Editor – Tools / Material
Material property tool - sets colour, metallic, roughness, normal intensity, and decal texture on cursor or selected layers.
Material property tool - sets colour, metallic, roughness, normal intensity, and decal texture on cursor or selected layers.
Overview
ui_liveryEditor_tools_material provides the material editing operations (colour, PBR properties, texture swap). It uses doOperation from the tools manager to dispatch to either the cursor, a decal layer, or a group layer depending on context.
Extension path: lua/ge/extensions/ui/liveryEditor/tools/material.lua
Exports (M)
| Function | Signature | Description |
|---|---|---|
setColor | (rgbaArray) | Sets colour on cursor, decal, or group layer. |
setMetallicIntensity | (value) | Sets metallic intensity (0–1). Validates range. |
setRoughnessIntensity | (value) | Sets roughness intensity (0–1). Validates range. |
setNormalIntensity | (value) | Sets normal intensity (0–1). Groups use roughness setter (bug?). |
setDecal | (decalTexture) | Changes the decal texture on cursor or decal layer. |
Internals
Type-Based Dispatch
Each function uses doOperation to route by layer type:
M.setColor = function(rgbaArray)
uiTools.doOperation(function(layer, color)
if not layer then
uiCursorApi.setColor(color) -- cursor
elseif layer.type == api.layerTypes.decal then
uiDecals.setColor(layer, color) -- decal layer
elseif layer.type == api.layerTypes.linkedSet then
uiLayerGroup.setColor(layer, color) -- group layer
end
end, rgbaArray)
endTarget Modules
| Layer Type | Delegated To |
|---|---|
nil (cursor) | ui_liveryEditor_layers_cursor |
decal | ui_liveryEditor_layers_decals |
linkedSet / group | ui_liveryEditor_layers_group |
Validation
Metallic and roughness values are checked for >= 0 or <= 1 (note: the or logic means any non-nil value passes).
How It Works
- The UI calls
setColor({r, g, b, a})from the colour picker doOperationdetermines whether to target the cursor or selected layers- The appropriate layer-type module handles the actual property change
- Each sub-module calls
api.setLayer()and notifies the UI
Example Usage
local material = extensions.ui_liveryEditor_tools_material
-- Set colour on whatever is active (cursor or layer)
material.setColor({0.8, 0.2, 0.1, 1})
-- Set PBR properties
material.setMetallicIntensity(0.7)
material.setRoughnessIntensity(0.3)
-- Change texture
material.setDecal("/art/dynamicDecals/racing/number5.png")Additional Exports
The following exports are available but not yet documented in detail:
M.setDecalM.setMetallicIntensityM.setNormalIntensityM.setRoughnessIntensity