Scene Tree
The editor's scene tree window - a hierarchical tree view of all scene objects with filtering, drag-and-drop reordering, multi-selection, prefab support, virtual scrolling, and undo/redo for group ope
The editor's scene tree window - a hierarchical tree view of all scene objects with filtering, drag-and-drop reordering, multi-selection, prefab support, virtual scrolling, and undo/redo for group operations.
Public API (Key Functions)
| Function | Signature | Description |
|---|---|---|
M.onEditorGui | () | Main GUI render loop - handles all scene tree instances |
M.onEditorInitialized | () | Registers windows, preferences, object class icons |
M.onEditorObjectSelectionChanged | () | Updates tree node selection state to match editor selection |
Key Features
- Multiple instances: Via
guiInstancer- each instance has independent state - Search & filter: By name, ID, persistent ID, class, or all; with distance-based range filtering
- Virtual scrolling: Efficient rendering of large scene trees
- Drag and drop: Reorder objects between groups with undo support
- Breadcrumb path: Shows parent hierarchy of selected node
- Prefab V2 support: Package/unpackage/convert operations in context menu
- Node operations: Rename, delete, duplicate, create groups, sort, collapse, hide/lock toggles
Search Modes
| Mode | Searches |
|---|---|
SearchMode_Name | Display name and object name |
SearchMode_ID | Object ID |
SearchMode_PersistentID | Persistent ID |
SearchMode_Class | Class name |
SearchMode_All | All of the above |
Scene Tree Node Structure
local node = {
id = 123, -- Object ID
name = "MyObject",
displayName = "MyObject (shape.dae)",
className = "TSStatic",
icon = editor.icons.shape,
open = false,
selected = false,
isGroup = false,
isExpandable = false,
parent = parentNode,
children = {},
renderChildrenOrder = {},
listIndex = 1, -- Virtual scroll index
}Notes
- Max group nesting: 30 levels (protection against cyclic references)
- Expandable classes:
PrefabInstance,SimGroup,SimSet - TSStatic nodes display shape filename; DecalRoads display material name
- Uses
socket.gettime()for rename delay timing
Functions
M.onEditorActivated()
Callback for editor activated event.
M.onEditorSaveGuiInstancerState(state)
Saves per-instance scene tree state (scroll position, open nodes, etc.).
state(table)
M.onEditorLoadGuiInstancerState(state)
Restores per-instance scene tree state.
state(table)
M.onExtensionLoaded()
Initializes scene tree on extension load.
M.onEditorAfterOpenLevel()
Recaches all scene tree nodes after a level is opened.
M.onEditorToolWindowGotFocus(windowName)
Handles focus gained on scene tree window.
windowName(string)
M.onEditorToolWindowLostFocus(windowName)
Handles focus lost on scene tree window.
windowName(string)
M.onEditorBeforeSaveLevel()
Pre-save cleanup for scene tree state.
M.onEditorObjectAdded()
Updates scene tree when new objects are added to the scene.
M.onEditorInspectorFieldChanged(selectedIds)
Refreshes node names when inspector fields change.
selectedIds(table)
M.moveSelectionIndex(up)
Moves the selection highlight up or down in the tree.
up(boolean)
M.refreshNodeNames(objectIds)
Refreshes display names for specific object IDs.
objectIds(table)
M.refreshAllNodes(incomingObjectIds)
Refreshes all scene tree nodes, optionally limited to specific IDs.
incomingObjectIds(table|nil)
M.recacheAllNodes(keepOpenStatus)
Full recache of all scene tree nodes from the scene graph.
keepOpenStatus(boolean)
M.closeAllInstances()
Closes all scene tree window instances.
M.openSceneTree()
Opens a scene tree window instance.
M.debugNode(id, level)
Debug: prints node hierarchy to console.
id(number)level(number)
See Also
- Editor AI Tests - Related reference
- Editor AI Visualization - Related reference
- Editor – Assembly Spline Tool - Related reference
- World Editor Guide - Guide
Road Utilities
Utility module for road template operations - handles template loading, child road creation, decoration placement, random decal generation, and material management.
Scene View
Provides additional scene view windows in the editor - supports 3D, orthographic, camera path, and vehicle-attached view modes with configurable frustum, clipping, and debug draw masks.