trackBuilder/materialUtil - Track Material Management
Reference for `extensions/util/trackBuilder/materialUtil.lua`. Manages track surface materials (colors, textures, glow, ground type) for the 8 material slots (A–H) used by the track editor.
Reference for extensions/util/trackBuilder/materialUtil.lua. Manages track surface materials (colors, textures, glow, ground type) for the 8 material slots (A–H) used by the track editor.
Exports
| Key | Signature | Description |
|---|---|---|
getMaterials | () → table | Returns current materials with default values removed |
setMaterials | (materials, skipSet) | Applies a table of materials keyed by letter |
setSingleMaterial | (letter, material, skipSet) | Applies a full material definition to one slot |
loadMaterials | (?) | Reference exists but function not defined locally |
currentMaterials | table | Live material state for all 8 slots |
resetMaterialsToDefault | (letter?) | Resets one or all slots to original defaults |
Internals
- 8 material slots labeled A–H. Each slot has a
centerandbordermaterial object looked up viascenetree.findObject("track_editor_X_center/border"). - Material properties:
baseCenterColor,baseBorderColor,centerColor,borderColor,baseTexture,baseTextureN,baseTextureS,centerTexture,borderTexture,centerGlow,borderGlow,groundtype. - Defaults: Slots A–D are light gray asphalt with colored borders (orange/green/blue/red). Slots E–H are dark with glow-enabled neon strips.
removeDefaults(material, original)strips unchanged values for compact serialization.fillDefaults(material, original)restores omitted values from the original template.
How It Works
loadMaterial(letter)finds the scenetree material objects and reads their current state.setSingleMaterial(letter, material)writes all properties (textures, colors, glow, groundmodel) then flushes and reloads the engine material.getMaterials()loads all 8 slots, then returns a diff against the originals so only changed properties are included.setMaterials(materials)iterates the input table and applies each slot viasetSingleMaterial.
-- Change slot A border to green
local mat = materialUtil.currentMaterials['A']
mat.borderColor = {0.2, 0.8, 0.2, 1}
materialUtil.setSingleMaterial('A', mat)
-- Get compact materials for saving
local mats = materialUtil.getMaterials()
-- mats['A'] only contains fields that differ from defaultsAdditional Exports
M.currentMaterials- (undocumented)M.getMaterials- (undocumented)M.loadMaterials- (undocumented)M.resetMaterialsToDefault- (undocumented)M.setMaterials- (undocumented)M.setSingleMaterial- (undocumented)
trackBuilder/markers - Track Marker Interpolation & Visualization
Reference for `extensions/util/trackBuilder/markers.lua`. Manages visual editor markers (bank, height, width, checkpoints, walls, ceiling) and interpolates track properties between control points.
trackBuilder/meshes - Cross-Section Mesh Definitions
Reference for `extensions/util/trackBuilder/meshes.lua`. Defines cross-section profiles (tubes and side walls) used by the track builder's procedural mesh system.