simvx.core.scene

Scene serialization — save/load node trees as JSON or pickle.

Both backends serialize to the same plain-dict intermediate format. Pickle stores the dict (not raw Node objects), avoiding class-path brittleness and GPU state issues.

Public API: save_scene(node, path, format=”json”) load_scene(path, format=None) # auto-detects from extension

Module Contents

Classes

PackedScene

Reusable scene resource that loads once and can be instanced many times.

Functions

save_scene

Save a node tree to disk.

load_scene

Load a node tree from disk.

Data

API

simvx.core.scene.log[source]

‘getLogger(…)’

simvx.core.scene.CURRENT_FORMAT_VERSION

1

simvx.core.scene.MIGRATIONS: dict[tuple[int, int], collections.abc.Callable[[dict], dict]]

None

simvx.core.scene.save_scene(node: simvx.core.node.Node, path: str | pathlib.Path, format: str = 'json')[source]

Save a node tree to disk.

Args: node: Root node to serialize. path: Output file path. format: “json” or “pickle”.

simvx.core.scene.load_scene(path: str | pathlib.Path, format: str | None = None) simvx.core.node.Node[source]

Load a node tree from disk.

Args: path: Input file path. format: “json”, “pickle”, or None to auto-detect from extension.

Returns: Reconstructed root Node.

class simvx.core.scene.PackedScene(path: str | pathlib.Path)[source]

Reusable scene resource that loads once and can be instanced many times.

The scene file is lazily parsed on the first call to instance(). Subsequent calls deep-copy the cached data to produce independent node trees.

Initialization

instance() simvx.core.node.Node[source]

Load and return a new node tree from the scene file.

save(node: simvx.core.node.Node)[source]

Save a node tree to this PackedScene’s path.