Road Architect - Export
Handles serialization and export of Road Architect road data to JSON files. Converts road structures (nodes, profiles, layers, groups, junctions, overlays) into a portable format.
Handles serialization and export of Road Architect road data to JSON files. Converts road structures (nodes, profiles, layers, groups, junctions, overlays) into a portable format.
Public Functions
| Function | Signature | Description |
|---|---|---|
M.export | (...) | Exports road data to JSON |
Example: Exporting Road Data
local export = require('editor/tech/roadArchitect/export')
-- Export all roads, groups, junctions, and prefabs to file
export.exportRoads(roads, groups, junctions, prefabs, '/levels/myLevel/roads.roadArchitect.json')
-- Export a single road for template/prefab use
export.exportSingleRoad(selectedRoad, '/levels/myLevel/templates/highway.json')
-- Exported JSON structure:
-- {
-- "version": <number>,
-- "roads": [
-- {
-- "name": "road1",
-- "nodes": [ { "pos": [x,y,z], "width": w, ... } ],
-- "profile": { "name": "...", "layers": [...] },
-- "isOverlay": false,
-- "isBridge": false,
-- ...
-- }
-- ],
-- "groups": [...],
-- "junctions": [...],
-- "prefabs": [...]
-- }
-- Serialization handles:
-- - vec3 positions → array [x, y, z]
-- - ImGui pointer values → raw numbers
-- - Nested profile/layer structures
-- - Junction connection topology
-- - Group membership referencesNotes
- Uses
jsonWriteFilefor atomic file writes - Version field enables forward-compatible deserialization
- Paired with
import.luafor loading
See Also
- Road Architect - Clothoid - Related reference
- Road Architect - Decals - Related reference
- Road Architect - Geometry - Related reference
- World Editor Guide - Guide
Road Architect - Decals
Manages road surface decals (lane markings, arrows, patches) for the Road Architect. Creates, positions, and manages DecalRoad and MeshRoad Torque objects along lane edges and surfaces.
Road Architect - Geometry
Core geometry module for the Road Architect. Computes road meshes from node chains using Catmull-Rom spline interpolation, lateral offset sampling, elevation blending, and procedural mesh generation.