Skip to main content

Module ops

Module ops 

Source
Expand description

Headless editor operations: pure tree/scene/error logic with no egui.

app.rs calls these from UI callbacks and routes every Err to the console; nothing here touches the UI, so it is all unit-testable.

Structs§

InstanceRefs
Paths needed to resolve [[instance]] scene references while saving.

Functions§

add_node
Insert a node of type_name under parent (defaults to the tree root). The id is derived from name plus a counter until unique. Unknown types and missing parents are errors.
build_doc
Build a saveable SceneDoc from the live tree, in tree order.
gutter_marks
Parse Python-traceback line N (File "...", line N) marks: one 1-based line (last match wins) plus the error’s last non-empty line (the exception line, not the Traceback header). Entries without a line number (clean strings) are ignored.
move_node
Reparent id under new_parent. Cycle and root errors surface as-is.
move_sibling
Shift id by delta slots among its siblings (negative moves up). Out-of-range shifts clamp to the first/last slot; parentless nodes and the root are errors.
place_node
Place id under new_parent at child index (clamped to the end). Unlike move_node this controls sibling order: index 0 makes it first. Refuses unknown nodes, root moves, and cycles (under itself or a descendant); the node keeps its subtree.
registered_types
Closed node-type set. Mirrors NodeTypeRegistry::new; kept here because the registry exposes no listing API and the editor must not touch core.
remove_node
Remove id and its subtree. Refusing the root is a console-grade error.
save_text
Thin file write used by scene and script saves.
set_prop
Set one prop on id. Unknown nodes are errors.