Skip to content

Workspace editing and tracked operations ​

These examples use ws = client.workspace from a flarelive-client RPC connection. Normal methods are synchronous; ws.submit.method(...) returns a tracked Operation for asynchronous use. Handles and their world generation are validated before work.

AreaMain operations
Documentnew_world, open_world, save_world
Preparation/runtimebegin_experiment, end_experiment, initialize_simulation, clear_simulation, reset_simulation
Progressionset_automatic_simulation, advance_simulation, exchange_simulation_io
Editingcreate/remove/replace, set/reset property, transforms, reparent/move
Assetsactions/run_action, get_preset_members, instantiate_preset, remove_preset_collection
Graph duplicationclone_object(s), copy_objects, paste_objects
UI-shared stateselection/set_selection, history/undo/redo
Observationinspection queries, export_simulation, events

Transactions and batches ​

python
with ws.transaction("Create observer"):
    camera = ws.create_object("simexp.core.camera")
    ws.set_property(camera, "name", "Observer")
    ws.set_property(camera, "vertical_fov", 40.0)

Transactions group history/edit rollback, not physics or files. Another client cannot join your transaction. edit_batch is one atomic editing command with earlier-result references; ordinary JSON-RPC wire batches are non-atomic:

python
results = ws.edit_batch([
    {"method": "create_object", "params": {"type_name": "simexp.core.camera"}},
    {"method": "set_property", "params": {
        "object": {"$result": 0}, "path": "name", "value": "Observer"}},
], label="Create observer")

Copy returns versioned text, not system-clipboard side effects. Paste remaps internal references and captures preset dependencies. Default same-world paste reuses matching live presets; other worlds/missing/replaced presets use snapshots. Clone-preset mode makes private dependencies. Only copied roots receive name suffixes. Include external scene dependencies for cross-world paste; arbitrary foreign references cannot be preserved.

Tasks and failures ​

python
operation = ws.submit.initialize_simulation()
print(operation.id, operation.status())
operation.result(timeout=120)

Operation terminal phases are succeeded/failed/cancelled. Queued work can cancel; running explicit advancement checks between steps and retains completed work. Initialization/save/reset/clear and atomic I/O are not interruptible. A timeout neither cancels nor rolls back.

Keep the same client/Operation after an uncertain response. SubmissionUncertainError requires client.recover_pending() to recover the original identity before retrying mutations. A terminal failure can still have effects. client.status is a cached bounded view; ws.state is executor-ordered and can wait behind work. Events are notifications, not operation results; refresh after cursor gaps.

Saving ​

save_world saves Document and waits for actual disk success. Document edits remain in memory until saved; Experiment and Simulation edits are temporary. See editing and saving through RPC for the reusable-project workflow.

Background snapshot capture can release GUI busy state earlier; document_saving/save_target/save_error and the original Operation describe the remaining write. document_needs_save drives the title marker; document_dirty compares with the written revision. Later edits are not included in the pending snapshot. Normal shutdown waits accepted writes.

Closing a client schedules its pending-work/transaction cleanup but does not clear Simulation, end Experiment or undo committed edits. Do not use process termination as routine cancellation.