simvx.editor.state

Editor State — Central state manager for the editor.

Module Contents

Classes

EditorState

Central state manager holding all editor state.

API

class simvx.editor.state.EditorState

Bases: simvx.core.file_state.FileStateMixin

Central state manager holding all editor state.

Acts as the single source of truth for the editor — panels read from and write to this object, coordinating via signals.

Scene-specific state (edited_scene, selection, undo_stack, editor_camera, viewport_mode, _modified) is delegated to the active scene tab via WorkspaceTabs. Fallback objects are used when no scene tab is active.

Initialization

property edited_scene: simvx.core.SceneTree
property current_scene_path: pathlib.Path | None
property selection: simvx.core.Selection
property undo_stack: simvx.core.UndoStack
property editor_camera: simvx.core.EditorCamera3D
property viewport_mode: str
property project_root: str
property modified: bool
new_scene(root_type: type = Node)

Create a new scene tab with the given root type.

open_scene(path: str | pathlib.Path)

Load a scene from disk into the active tab, or a new tab.

save_scene(path: str | pathlib.Path | None = None)

Save the current scene.

play_scene()

Enter play mode on the active scene tab.

pause_scene()

Toggle pause during play mode.

stop_scene()

Exit play mode and restore the scene.

set_script_text(text: str)

Set the code viewport text and sync it to the selected node’s script.

attach_script(node: simvx.core.Node, path: str)

Attach a file-based script to node.

detach_script(node: simvx.core.Node)

Detach the file-based script from node.

create_script(node: simvx.core.Node, template_name: str, class_name: str, rel_path: str) str | None

Create a new script file from a template and attach it to node.

get_scene_title() str
find_node(path: str) simvx.core.Node | None
rename_node(node: simvx.core.Node, new_name: str)
set_node_property(node: simvx.core.Node, prop: str, value)
add_node(node: simvx.core.Node, parent: simvx.core.Node | None = None)
remove_node(node: simvx.core.Node)
duplicate_node(node: simvx.core.Node) simvx.core.Node | None
enter_place_mode(node_class: type)
cancel_place_mode()
place_node_at(x: float, y: float, parent: simvx.core.Node | None = None)