From b0c99e9c7df3179401d248316b9c56648528fdc2 Mon Sep 17 00:00:00 2001 From: xeolabs Date: Tue, 3 Dec 2024 12:10:23 +0100 Subject: [PATCH] [FIX] Fix missing MetaObject->metaModels links --- src/viewer/metadata/MetaModel.js | 1 + src/viewer/metadata/MetaScene.js | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/viewer/metadata/MetaModel.js b/src/viewer/metadata/MetaModel.js index 5fef5b79d6..f86ce6ab81 100644 --- a/src/viewer/metadata/MetaModel.js +++ b/src/viewer/metadata/MetaModel.js @@ -232,6 +232,7 @@ class MetaModel { this.rootMetaObjects.push(metaObject); metaScene.rootMetaObjects[id] = metaObject; } + metaObject.metaModels.push(this); } } } diff --git a/src/viewer/metadata/MetaScene.js b/src/viewer/metadata/MetaScene.js index 93528cb5ef..4d79110000 100644 --- a/src/viewer/metadata/MetaScene.js +++ b/src/viewer/metadata/MetaScene.js @@ -1,7 +1,6 @@ import {MetaModel} from "./MetaModel.js"; import {MetaObject} from "./MetaObject.js"; import {PropertySet} from "./PropertySet.js"; -import {math} from "../scene/math/math.js"; /** * @desc Metadata corresponding to a {@link Scene}. @@ -188,13 +187,14 @@ class MetaScene { if (metaModel.metaObjects) { for (let i = 0, len = metaModel.metaObjects.length; i < len; i++) { const metaObject = metaModel.metaObjects[i]; - const type = metaObject.type; const id = metaObject.id; - if (metaObject.metaModels.length === 1&& metaObject.metaModels[0].id === metaModelId) { // MetaObject owned only by this model, delete + if (metaObject.metaModels.length === 1 && metaObject.metaModels[0].id === metaModelId) { // MetaObject owned only by this model, delete delete this.metaObjects[id]; if (!metaObject.parent) { delete this.rootMetaObjects[id]; } + } else { + metaObject.metaModels = metaObject.metaModels.filter(metaModel => metaModel.id !== metaModelId); } } }