Skip to content

Commit

Permalink
Resolve variable links for BGs
Browse files Browse the repository at this point in the history
  • Loading branch information
keianhzo committed Dec 4, 2023
1 parent b951508 commit d5f3a71
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/components/gltf-model-plus.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit d5f3a71

Please sign in to comment.