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¶
- simvx.core.scene_tree.log¶
‘getLogger(…)’
- class simvx.core.scene_tree.SceneTree(screen_size=None)¶
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 screen_size: tuple[float, float]¶
- set_root(root: simvx.core.node.Node)¶
Set the root node of the scene tree.
- change_scene(new_root: simvx.core.node.Node)¶
Replace the current scene root with a new one. Autoloads persist.
- process(dt: float)¶
Run process callbacks and coroutines on all nodes for one frame.
- physics_process(dt: float)¶
Run physics_process callbacks on all nodes, then auto-step physics.
- propagate_input(event) None¶
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.
- draw(renderer)¶
- push_popup(control)¶
Register a control as an active popup (drawn on top, receives input first).
- pop_popup(control)¶
Unregister a popup control.
- input_cast(screen_pos: tuple[float, float] | numpy.ndarray, button: int = 1)¶
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]¶
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)¶
Register a node as an autoload singleton. Autoloads persist across change_scene().
- remove_autoload(name: str)¶
Remove and detach an autoload singleton by name.
- get_unique(name: str) simvx.core.node.Node | None¶
Get a unique node by name. Returns None if not found.
- ui_input(mouse_pos: tuple[float, float] | numpy.ndarray = None, button: int = 0, pressed: bool = True, key: str = '', char: str = '')¶
Route UI input events to controls.