Drag Race Editor - Strips
Manages drag racing strip data: loading, selecting, adding, removing, saving, and editing strips with lanes, waypoints, and boundaries. Provides ImGui UI for strip/lane/waypoint/boundary selection and
Manages drag racing strip data: loading, selecting, adding, removing, saving, and editing strips with lanes, waypoints, and boundaries. Provides ImGui UI for strip/lane/waypoint/boundary selection and editing, plus 3D world-space debug drawing and gizmo manipulation.
Public API
| Function | Signature | Description |
|---|---|---|
M.loadAllStrips | () | Loads all strips from dragSaveSystem.getAllStrips() |
M.getAllStrips | () → table | Returns the loaded strips array |
M.getSelectedStripIndex | () → number | Returns currently selected strip index |
M.setSelectedStripIndex | (index) | Sets selected strip index |
M.getSelectedStrip | () → table|nil | Returns selected strip data or nil |
M.selectStrip | (index) | Selects strip, clears facility/settings selections, updates drag settings |
M.addStrip | () | Opens file dialog, creates default strip with 2 lanes and saves to JSON |
M.removeSelectedStrip | () | Removes selected strip, adjusts selection |
M.saveStrip | (strip) → bool | Saves strip JSON to level drag path |
M.drawStripsList | () | ImGui list with Add/Remove/Save/Refresh buttons |
M.drawStripDetails | () | ImGui detail panel: ID, Name, Description, lanes, end camera |
M.editLane | (stripIdx, laneIdx) → table|nil | Sets selection and returns lane data |
M.getSelectedLane | () → table|nil | Returns currently selected lane |
M.drawLaneEditor | () | ImGui lane editor: ID, name, color, waypoints, boundary |
M.drawStripsPreview | () | Debug draws strip name, waypoints, boundaries in world |
M.enableWaypointGizmo | (waypoint) | Activates axis gizmo for waypoint transform |
M.enableBoundaryGizmo | (boundary) | Activates axis gizmo for boundary transform |
M.beginWaypointDrag | (waypoint) | Stores undo state for waypoint drag |
M.draggingWaypoint | (waypoint) | Updates waypoint transform from gizmo |
M.endWaypointDrag | (waypoint) | Clears waypoint drag state |
M.beginBoundaryDrag | (boundary) | Stores undo state for boundary drag |
M.draggingBoundary | (boundary) | Updates boundary transform from gizmo |
M.endBoundaryDrag | (boundary) | Clears boundary drag state |
M.drawWaypointsInWorld | () | Debug draws waypoint spheres for selected strip |
M.drawAxisBox | (corner, x, y, z, clr) | Helper: draws axis-aligned box with debug triangles |
M.drawBoundariesInWorld | () | Debug draws boundary boxes for all lanes |
Strip Data Structure
-- Default strip created by addStrip()
{
id = "new_strip_1",
name = "New Strip",
description = "A new drag racing strip",
endCamera = nil,
metadata = { created = os.date(), modified = os.date() },
lanes = {
{ id = "lane_left", name = "Left Lane", color = "blue", laneOrder = 1,
waypoints = { { type = "stage", transform = {...} }, { type = "endLine", transform = {...} } },
boundary = nil }
}
}Usage Example
local strips = require('editor/dragRaceEditor/strips')
strips.loadAllStrips()
strips.selectStrip(1)
local strip = strips.getSelectedStrip()
if strip then
strips.saveStrip(strip)
endDependencies
| Module | Purpose |
|---|---|
editor/dragRaceEditor/constants | Color constants, default transforms |
editor/dragRaceEditor/state | Shared editor state (search, transforms, mouse) |
editor/dragRaceEditor/utils | markUnsavedChanges(), setupTransform() |
gameplay/drag/saveSystem | Strip file I/O |
ui_imgui / ffi | ImGui widgets, string conversion |
Module Variables
waypointDragStart(table) - Stores initial transform state during waypoint drag for undo.boundaryDragStart(table) - Stores initial transform state during boundary drag for undo.
See Also
- Drag Race Editor Constants - Related reference
- Drag Race Editor - Drag Settings - Related reference
- Drag Race Editor - Facilities - Related reference
- World Editor Guide - Guide
Drag Race Editor - State
Centralized state management module for the Drag Race Editor. Provides getters/setters for all editor state including selections, undo/redo stacks, file paths, transforms, and error handling.
Drag Race Editor - Utils
Utility functions for the drag race editor: error display, undo/redo stack, data validation, lane creation, mouse info tracking, and transform setup.