Editor Tool Utilities – Spline Input
Central input handler for spline-editing tools. Manages mouse/keyboard events for adding, inserting, dragging, and deleting spline nodes. Supports rib (width) and bar (velocity/height) handle dragging
Central input handler for spline-editing tools. Manages mouse/keyboard events for adding, inserting, dragging, and deleting spline nodes. Supports rib (width) and bar (velocity/height) handle dragging, loop/join formation, cross-tool selection, copy/paste profiles, gizmo control, and nav graph path editing.
Public API
| Function | Signature | Description |
|---|---|---|
M.handleSplineEvents | (splines, out, isRotEnabled, isConformToTerrain, useRibs, useBars, isBarsLimits, useCopyPaste, useGizmo, isLockShape, defaultWidth, deepCopyFn, deepCopyStateFn, copyProfileFn, pasteProfileFn, afterEndDragCb, joinFn, undoFn, redoFn, undoStateFn, redoStateFn) | Main per-frame spline event handler with full feature set |
M.handleNavGraphEvents | (selSpline, nodes, deepCopyFn, undoFn, redoFn, isBarsLimit) | Per-frame handler for nav-graph-based path editing with bar dragging |
M.registerSplineTool | (prefix, getSplinesFn, getEditModeKeyFn, deepCopyFn, deepCopyStateFn, uiModuleName) | Registers a spline tool for cross-tool hit detection and selection switching |
Code Examples
local splineInput = require('editor/toolUtilities/splineInput')
-- Register your spline tool for cross-tool selection
splineInput.registerSplineTool(
'Road', -- tool prefix (display name)
function() return roadSplines end, -- function returning splines array
function() return 'roadEditMode' end, -- function returning editMode key
deepCopyRoadSpline, -- deep copy single spline
deepCopyAllRoadState, -- deep copy full tool state
'editor_roadSpline' -- UI module name for setSelectedSplineIdx
)
-- Per-frame spline event handling
-- out = { spline = 1, node = 1, isGizmoActive = false }
splineInput.handleSplineEvents(
splines, out,
true, -- rotation enabled
true, -- conform to terrain
true, -- use rib handles (width)
true, -- use bar handles (velocity)
false, -- bars represent velocities (not limits)
true, -- enable copy/paste
true, -- enable gizmo
false, -- shape not locked
10.0, -- default spline width
deepCopy, deepCopyState,
copyProfile, pasteProfile,
afterEndDrag, joinSplines,
undoFn, redoFn, undoStateFn, redoStateFn
)
-- Nav graph path editing (for drive path tools)
splineInput.handleNavGraphEvents(
selectedSpline,
navGraphNodes,
deepCopySpline,
undoCallback,
redoCallback,
true -- bars represent velocity limits
)
-- Cross-tool interaction features:
-- Clicking a node from another tool auto-switches edit modes
-- Distance-adaptive hit detection (sqrt scaling with camera distance)
-- Priority system: node > rib > bar > spline-body
-- Keyboard shortcuts:
-- ALT → toggle gizmo
-- DELETE → delete selected node
-- CTRL+C/V → copy/paste profile
-- SHIFT + drag → precision mode (0.1x sensitivity)
-- SHIFT + drop → form loop (same spline) or join (different splines)See Also
- Tool Utilities - Fit Polyline - Related reference
- Editor Tool Utilities – Geometry - Related reference
- Editor Tool Utilities – Gizmo - Related reference
- World Editor Guide - Guide
Editor Tool Utilities – Skeleton (Image Vectorisation)
Suite for converting PNG bitmap images to vectorised polylines. Pipeline: bitmap → binary mask → Guo-Hall skeletonisation → keypoint detection → path extraction → join/filter → width estimation → RDP
Editor Tool Utilities – Spline Mask Export
Exports spline ribbon surfaces as a binary PNG mask file (GFXFormatR16) covering the full terrain extent. Uses kd-tree spatial queries and barycentric quad intersection for efficient rasterisation.