simvx.editor.scene_file_ops¶
Scene file operations mixin for State.
Module Contents¶
Classes¶
Mixin providing scene lifecycle and file dialog operations. |
API¶
- class simvx.editor.scene_file_ops.SceneFileOps[source]¶
Mixin providing scene lifecycle and file dialog operations.
Methods in this class are designed to be mixed into State, which provides the workspace, signals, and delegating properties they depend on.
- new_scene(root_type: type = Node, *, populate: bool = False)[source]¶
Create a new scene tab with the given root type.
- open_scene(path: str | pathlib.Path)[source]¶
Load a scene from disk into the active tab, or a new tab.
- save_scene(path: str | pathlib.Path | None = None, *, force: bool = False)[source]¶
Save the current scene.
Dispatches based on the active workspace tab:
Untitled scratch buffer: opens a file-save dialog. On accept the buffer’s text is written to disk and the tab is promoted to a regular file-backed script tab.
Script tab (file or embedded): forwards to
workspace.save_current_script.Scene tab (or no active tab): falls through to the scene-save path.
Scene save:
For an existing on-disk source: parse it, reconcile the runtime tree against the parsed source via :func:
apply_runtime_diff, and write back via :meth:SceneFile.save— preserving comments, blank lines, hand-written code, and import ordering.For a brand-new scene (path didn’t exist or wasn’t set): emit greenfield via :meth:
SceneFile.from_runtime+save.Folder scenes (when
pathis a directory) route through- Class:
SceneModule.
force=Trueskips the unresolved-reference warning dialog (used by the dialog’s “Save anyway” callback to avoid re-prompting).