From f2e9bccb3969b91bd3f3e318e28dd0d1852ca634 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Wed, 1 Apr 2026 00:10:40 +0200 Subject: [PATCH] Add support for animation fields in model instances and interaction links during scene document migration from v11 to v12 --- src/document/migrate-scene-document.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/document/migrate-scene-document.ts b/src/document/migrate-scene-document.ts index 7b3b039d..d3de077f 100644 --- a/src/document/migrate-scene-document.ts +++ b/src/document/migrate-scene-document.ts @@ -1114,6 +1114,27 @@ export function migrateSceneDocument(source: unknown): SceneDocument { }; } + // v11 → v12: animation fields added to model instances and interaction links + // readModelInstance now reads animationClipName/animationAutoplay as optional (defaulting to undefined) + // so no special handling is needed beyond routing through the same readers + if (source.version === 11) { + const materials = readMaterialRegistry(source.materials, "materials"); + const assets = readAssets(source.assets); + + return { + version: SCENE_DOCUMENT_VERSION, + name: expectString(source.name, "name"), + world: readWorldSettings(source.world), + materials, + textures: expectEmptyCollection(source.textures, "textures"), + assets, + brushes: readBrushes(source.brushes, materials, false), + modelInstances: readModelInstances(source.modelInstances, assets), + entities: readEntities(source.entities), + interactionLinks: readInteractionLinks(source.interactionLinks) + }; + } + if (source.version !== SCENE_DOCUMENT_VERSION) { throw new Error(`Unsupported scene document version: ${String(source.version)}.`); }