simvx.core.scene_tree¶
SceneTree — Central manager for the node tree, groups, input routing, and UI focus.
Module Contents¶
Classes¶
Central manager for the node tree, groups, input routing, and UI focus. |
Data¶
API¶
- class simvx.core.scene_tree.SceneTree(screen_size=None)[source]¶
Central manager for the node tree, groups, input routing, and UI focus.
Owns the root node and drives per-frame
process/physics_process/drawtraversals. Also manages pause state, scene changes, and the UI input pipeline (mouse, keyboard, popups).Initialization
- property app¶
The App instance running this tree (set by graphics backend).
- property screen_size: tuple[float, float]¶
- set_root(root: simvx.core.node.Node)[source]¶
Set the root node of the scene tree.
- change_scene(new_root: simvx.core.node.Node)[source]¶
Replace the current scene root with a new one. Autoloads persist.
- physics_process(dt: float)[source]¶
Run physics_process callbacks on all nodes, then auto-step physics.
- propagate_input(event) None[source]¶
Propagate an input event through the node tree.
Walks the tree front-to-back (children before parents, reversed child order). Each node’s
input()is called untilevent.handledis set.unhandled_input()is called on all remaining nodes regardless.
- push_popup(control)[source]¶
Register a control as an active popup (drawn on top, receives input first).
- input_cast(screen_pos: tuple[float, float] | numpy.ndarray, button: int = 1)[source]¶
Cast a ray from screen_pos through the camera into the scene. Finds the nearest pickable CollisionShape3D and delivers an InputEvent to its parent node.
- get_group(name: str) list[simvx.core.node.Node][source]¶
Get all nodes in a group.
- property autoloads: dict[str, simvx.core.node.Node]¶
Read-only view of registered autoloads.
- add_autoload(name: str, node: simvx.core.node.Node)[source]¶
Register a node as an autoload singleton. Autoloads persist across change_scene().
- get_unique(name: str) simvx.core.node.Node | None[source]¶
Get a unique node by name. Returns None if not found.