From ead649eec3304854affa359f62a274475487ef95 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 8 Sep 2026 21:09:53 +0200 Subject: [PATCH] Resolve container content from the template instead of copying it A scene now stores only the container object; its content is resolved from the template on every read, with deviations kept as sparse instanceEdits on the container object. This drops the propagation bookkeeping entirely -- templateSync.ts is gone and the three structural gaps (add, remove, reparent) cannot diverge any more. Values stay editable on an instance, structure does not; Unpack writes the content into the scene, keeping ids. Play mode bakes containers into the throwaway copy before entities are built. No migration: formatVersion is 2 and the seeders write the new format. Co-Authored-By: Claude Opus 5 --- README.md | 43 +- src/core/commands/applyCommands.ts | 167 ++++--- src/core/commands/colliderCommands.ts | 6 +- src/core/commands/containerCommands.ts | 93 ++-- src/core/commands/require.ts | 26 +- src/core/commands/sceneObjectCommands.ts | 162 +++---- src/core/commands/templateSync.ts | 89 ---- src/core/commands/variableCommands.ts | 29 +- src/core/model/Asset.ts | 6 +- src/core/model/Project.ts | 20 +- src/core/model/SceneObject.ts | 10 +- src/core/model/container.ts | 82 +--- src/core/model/instance.ts | 429 +++++++++++++++++ src/core/store/serialize.ts | 29 +- src/editor/debugHook.ts | 12 + src/editor/inspector/objectSection.ts | 233 +++++---- src/editor/panels/HierarchyPanel.ts | 22 +- src/editor/state.ts | 7 +- src/runtime/World.ts | 14 +- src/viewport/SceneViewport.ts | 29 +- src/viewport/items.ts | 9 +- tests/core/apply.test.ts | 45 +- tests/core/container.test.ts | 408 +++++++++------- tests/core/holders.test.ts | 50 +- tests/core/serialize.test.ts | 2 +- tests/helpers.ts | 9 +- tools/e2e/08-colliders.mjs | 2 +- tools/e2e/09-containers.mjs | 584 ++++++++++++++++------- tools/e2e/10-text-and-enabled.mjs | 2 +- tools/e2e/11-menus.mjs | 25 +- tools/e2e/12-textures.mjs | 3 +- tools/e2e/14-overflow.mjs | 2 +- tools/e2e/16-container.mjs | 106 +++- tools/lib/builders.mjs | 40 +- tools/lib/harness.mjs | 13 +- tools/seed-jumprun.mjs | 17 +- tools/smoke-jumprun.mjs | 59 ++- 37 files changed, 1878 insertions(+), 1006 deletions(-) delete mode 100644 src/core/commands/templateSync.ts create mode 100644 src/core/model/instance.ts diff --git a/README.md b/README.md index 26f70c0c..eaeacedc 100644 --- a/README.md +++ b/README.md @@ -15,13 +15,14 @@ Live: · Widget playground: ~