From abcd17f931d02bcc8986e64d02c1904693b937a6 Mon Sep 17 00:00:00 2001 From: netpro2k Date: Tue, 12 Oct 2021 18:07:27 -0700 Subject: [PATCH] Handle __mhc_link_type for nodes fixes video-texture-target --- src/editor/gltf/GLTFLoader.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/editor/gltf/GLTFLoader.js b/src/editor/gltf/GLTFLoader.js index c8c8695c..507d12f0 100644 --- a/src/editor/gltf/GLTFLoader.js +++ b/src/editor/gltf/GLTFLoader.js @@ -1995,7 +1995,20 @@ class GLTFLoader { const components = getComponents(object); for (const [componentName, componentProps] of Object.entries(components)) { for (const [propName, propValue] of Object.entries(componentProps)) { - if ( + const type = propValue && propValue.__mhc_link_type; + if (type && propValue.index !== undefined) { + // TODO support other types + if (type === "node") { + this.getDependency(type, propValue.index).then(node => { + node.userData.MOZ_spoke_uuid = node.uuid; + componentProps[propName] = { __gltfIndexForUUID: node.uuid }; + }); + } else { + console.warn( + `Spoke currently only supports "node" component references. This component ${componentName} is using a ${type} ref for ${propName}` + ); + } + } else if ( HUBS_NODEREF_COMPONENTS[componentName] && HUBS_NODEREF_COMPONENTS[componentName].indexOf(propName) !== -1 ) {