Skip to content

Projects

A project holds versioned spatial objects and data. Project operations support transactions, undo, and redo. Projects can be saved locally or shared through SpatialDrive.

An app contains the code that works with a project. Saving the app’s code does not save the project’s spatial data.

Project objects

Project objects form a hierarchy. Components describe their names, transforms, visibility, and geometry. Project types have a Project prefix and are defined under project.object.

Use transactions to group related project operations into one undoable edit. Use the local or remote project API to save and load projects.

The scene

Project synchronization writes versioned objects into the scene. The renderer displays that scene through viewports.

A direct scene edit does not change the project. The next synchronization can overwrite it. Use project.wait_for_scene_sync before a scene read that depends on a project operation. Use project.object.from_scene and to_scene to find the corresponding node. A scene node created independently has no project node.

Stored models

RemoteHandle references stored blob data. It is defined in the root types namespace. It does not specify the data format or storage location, or guarantee that the data exists. Statements that read it report missing data or an incompatible format.

Model import and loading tasks are defined under model. Await the task’s result, then pass the returned RemoteHandle to a scene or project component setter. The renderer streams geometry as it needs more detail.

Load a model and set a component

This native Python example imports a glTF file and adds a versioned mesh:

import spatialengine
from spatialengine.types.project.object import ProjectMesh
from spatialengine.types.project.object import ProjectName

with spatialengine.connect() as client:
    model = client.model.mesh.import_gltf(path="model.glb")
    with spatialengine.Transaction(client) as txn:
        node = txn.submit(client.project.object.spawn)
        txn.submit(client.project.object.name.set,
                   node=node, name=ProjectName(name="Model"))
        txn.submit(client.project.object.mesh.set,
                   node=node, mesh=ProjectMesh(data=model))
        txn.commit()
    client.project.wait_for_scene_sync()

For temporary geometry, construct a Mesh from the same handle and pass it to scene.mesh.set with a scene node. Use model.load to prepare an existing stored model before setting it in the scene.

CSV configuration is defined under model.csv. Its inspect(path=...) and inspect_string(csv=...) tasks propose column mappings. Block model and point cloud import tasks accept the resulting HeaderConfigMap. Project component types such as ProjectMesh and ProjectTransform are defined directly under project.object.

Older saved projects

Saved projects that use the old node, block-model, and point-cloud representation types are converted on load. Node IDs and stored model IDs stay the same. Remote projects with version 0.5 or newer node records also convert their submission metadata and object files in memory. Loading a remote project does not write the converted records to the server. Earlier remote node records require a snapshot export. Other old representation types are not migrated.