API ReferenceGE ExtensionseditorvehicleEditorstaticEditor
Vehicle Editor - Part Tree
Hierarchical tree view of JBeam part data with interactive 3D node/beam picking, selection, visibility toggling, and integration with the AST text view.
Hierarchical tree view of JBeam part data with interactive 3D node/beam picking, selection, visibility toggling, and integration with the AST text view.
Module Exports
| Export | Type | Description |
|---|---|---|
M.menuEntry | string | "Part Tree" - menu label |
M.open | function | Shows the part tree window |
M.onEditorGui | hook | Renders tree view and 3D picking overlay |
M.onEditorInitialized | hook | Registers the editor window |
M.onFileChanged | hook | Clears AST cache when source file changes |
Key Internals
| Variable | Type | Purpose |
|---|---|---|
ast | table/nil | Parsed AST data for current part's JBeam file |
astFilename | string/nil | Path to current JBeam file |
viewRawData | BoolPtr | Toggle between processed and raw AST data |
brokenNodes | table | Set of node IDs not found in any part |
Color Scheme
| Element | Color |
|---|---|
| Keys | Yellow (0.95, 0.84, 0.06) |
| Values (labels) | Blue (0.31, 0.73, 1) |
| Leaf elements | Pink (0.85, 0.39, 0.63) |
| Metadata | Gray (0.7, 0.7, 0.7) |
How It Works
Tree View (_renderNode)
- Recursively renders the parsed JBeam data as an ImGui tree
- Each node shows: expand/collapse, selection highlight, visibility toggle, edit button, and AST highlight button
- Selection links to AST text view via
vEditor.selectedASTNodeMap - Edit button sets
vEditor.propertyTableEditTargetfor the Part Property View - Hidden items are tracked via
__hiddenflag
3D Node/Beam Picking
Nodes (renderPickTransformNodes):
- Draws spheres at node positions (magenta for regular, blue-transparent for virtual)
- Raycasts from mouse to find intersecting node spheres
- Click to select; Shift+click for multi-select
- Selected nodes are transformed via
nodeTransformer.transformNodes()
Beams (renderPickTransformBeams):
- Draws lines between node pairs (green for regular, red for selected)
- Uses
closestLinePoints()for precise beam picking - Shows beam labels at center positions
- Virtual nodes (from other parts) are auto-resolved via
getNodefromAllParts()
Spawn Button
- Respawns the vehicle with the selected part as
mainPartName
Lua Code Example
-- Open part tree
extensions.editor_vehicleEditor_staticEditor_vePartTree.open()
-- Toggle "Raw Data" checkbox to see unprocessed JBeam data vs schema-processed
-- Tree rendering uses recursive _renderNode():
-- Each table entry gets: tree node, selection, visibility, edit, highlight buttons
-- Clicking selects and highlights corresponding AST nodes in text view
-- Node picking uses sphere intersection:
-- local dist, _ = intersectsRay_Sphere(rayStartPos, rayDir, nodePos, nodeCollisionRadius)
-- if dist and dist < 100 then
-- table.insert(hitNodes, {node, pos, keyInPickedNodes})
-- end
-- Beam picking uses closest line points:
-- local xnorm1, xnorm2 = closestLinePoints(rayStartPos, rayEndPos, p1, p2)
-- if xnorm2 >= 0 and xnorm2 <= 1 then
-- -- check perpendicular distance against beamCollisionRadius
-- end
-- Virtual nodes (referenced from other parts) are auto-loaded:
-- local node = getNodefromAllParts(nodeId)
-- node.__virtual = true -- rendered with translucent color
-- Multi-selection with Shift key:
-- if editor.keyModifiers.shift then
-- table.insert(vEditor.selectedNodes, chosenNodeData.node)
-- _selectAndHighlightNode(chosenNodeData.node)
-- end
-- Spawning with selected part as main:
-- vehicleConfig.mainPartName = vEditor.selectedPart
-- veh.partConfig = serialize(vehicleConfig)
-- veh:spawnObjectWithPosRot(pos.x, pos.y, pos.z, 0,0,0,1, true)
-- AST is cached and cleared on file change:
-- M.onFileChanged = function(filename, type)
-- if filename == astFilename then ast = nil end
-- endSee Also
- Vehicle Editor - JBeam Beautifier - Related reference
- Vehicle Editor - JBeam Modifier Leaking Visualizer - Related reference
- Vehicle Editor - JBeam Spellchecker - Related reference
- World Editor Guide - Guide
Vehicle Editor - Part Text View
Syntax-highlighted, scrollable text view of JBeam source files using AST rendering, with inline editing of string, number, and boolean values.
Vehicle Editor - Static Render View
Manages multiple independent render views for the static vehicle editor, with 3D/orthographic modes, axis gizmo navigation, grid overlays, and WASD camera control.