diff --git a/src/components/gltf-model-plus.js b/src/components/gltf-model-plus.js index c377811926..afe0615f75 100644 --- a/src/components/gltf-model-plus.js +++ b/src/components/gltf-model-plus.js @@ -919,6 +919,25 @@ class GLTFMozBehaviorExtension { } } } + for (const variable of graph.variables) { + const type = variable.valueTypeName; + const value = variable.initialValue; + if (type && value.index !== undefined) { + deps.push( + parser.getDependency(type, value.index).then(loadedDep => { + if (type === "texture" && !parser.json.textures[value.index].extensions?.MOZ_texture_rgbe) { + loadedDep.encoding = THREE.sRGBEncoding; + } + // Not associated materials don't get their components resolved in GLTFHubsComponentsExtension as they are not referenced by any object + if (type === "material" && !loadedDep.userData.gltfExtensions) { + loadedDep.userData.gltfExtensions = Object.assign({}, parser.json.materials[value.index].extensions); + } + value.dep = loadedDep; + return loadedDep; + }) + ); + } + } scenes[0].userData.behaviorGraph = graph; return Promise.all(deps);