Master Spline - Spline Manager
Core data management module for the Master Spline tool. Handles creation, deletion, serialization, undo/redo, splitting, joining, linking, and dirty-state updates for all master splines.
Core data management module for the Master Spline tool. Handles creation, deletion, serialization, undo/redo, splitting, joining, linking, and dirty-state updates for all master splines.
Public API
| Function | Signature | Description |
|---|---|---|
M.getToolPrefixStr | () → string | Returns "Master Spline" |
M.getEditModeKey | () → string | Returns "masterSpline" |
M.getMasterSplines | () → table | Returns the master splines array |
M.getIdToIdxMap | () → table | Returns the id-to-index lookup map |
M.addToMasterSplineArray | (spline) | Appends a spline to the array |
M.removeMasterSpline | (idx) | Removes spline at index (including layers) |
M.removeAllMasterSplines | () | Removes all master splines |
M.updateDirtyMasterSplines | (isAnalysis) | Updates geometry for all dirty splines |
M.manageLiveOptimise | (selectedIdx) | Runs homologation optimizer on selected spline |
M.addNewMasterSpline | (name?) → spline | Creates and returns a new master spline |
M.deepCopyMasterSpline | (spline) → table | Deep copies a single master spline |
M.deepCopyAllMasterSplines | () → table | Deep copies all master splines |
M.captureLinkedSplinesState | () → table | Captures state of all linked splines across tools |
M.captureTransTierState | () → table | Captures full state (master + linked splines) |
M.splitMasterSpline | (spline, idx, nodeIdx) | Splits a spline into two at the given node |
M.joinMasterSplines | (idx1, node1, idx2, node2) | Joins two splines at specified endpoints |
M.convertPathsToMasterSplines | (paths) | Converts bitmap-traced paths to master splines |
M.serializeMasterSpline | (spline) → table | Serializes for scene save |
M.deserializeMasterSpline | (data) → table | Deserializes from scene data |
M.unlinkAllSplines | (masterSpline) | Unlinks all layers from their linked splines |
M.updateLinkedSplineName | (id, type, name) | Updates a linked spline's name |
Undo/Redo Functions
| Function | Description |
|---|---|
M.lightSplineUndo/Redo | For property-only changes (name, banking, etc.) |
M.singleMasterSplineEditUndo/Redo | For single spline structural edits |
M.transMasterSplineEditUndo/Redo | For multi-spline transactional edits (split, remove all) |
M.undoLayerAdd/redoLayerAdd | Layer addition undo/redo |
M.undoLayerRemove/redoLayerRemove | Layer removal undo/redo |
M.undoAddNewMasterSpline/redoAddNewMasterSpline | New spline creation undo/redo |
Usage Example
local splineMgr = require('editor/masterSpline/splineMgr')
-- Create a new master spline
local newSpline = splineMgr.addNewMasterSpline("My Road")
-- Add nodes
table.insert(newSpline.nodes, vec3(0, 0, 0))
table.insert(newSpline.nodes, vec3(100, 0, 0))
table.insert(newSpline.widths, 10)
table.insert(newSpline.widths, 10)
table.insert(newSpline.nmls, vec3(0, 0, 1))
table.insert(newSpline.nmls, vec3(0, 0, 1))
newSpline.isDirty = trueDependencies
editor/masterSpline/layerMgreditor/masterSpline/homologationeditor/masterSpline/jumpTableseditor/toolUtilities/geom,util,roadDesignStandards- Linked tool modules:
meshSpline,assemblySpline,decalSpline,roadSpline
Functions
lightSplineRedo(data)
Handles light spline redo.
data(table)
singleMasterSplineEditRedo(data)
Handles single master spline edit redo.
data(table)
transMasterSplineEditRedo(splinesData)
Handles trans master spline edit redo.
splinesData(any)
Additional Exports
M.lightSplineRedoM.redoAddNewMasterSplineM.redoLayerAddM.redoLayerRemoveM.singleMasterSplineEditRedoM.transMasterSplineEditRedo
See Also
- Master Spline - Auto Road Generation - Related reference
- Master Spline - Homologation - Related reference
- Master Spline - Jump Tables - Related reference
- World Editor Guide - Guide
Master Spline - Layer Manager
Manages the layer system for master splines. Each layer represents a linked child spline (mesh, assembly, decal, or road) with lateral offset, flip, and width-tracking options.
Mesh Spline - Import
Handles importing existing scene mesh sequences into the Mesh Spline tool. Analyses patterns in TSStatic chains to detect caps, distribution modes, and mesh types, then reconstructs a parametric splin