Replies: 2 comments 7 replies
-
Hi, thanks for trying the latest version. Can you share more details on how you are using model-viewer? Which params you're setting etc.
|
Beta Was this translation helpful? Give feedback.
-
Same here, I'm updating material texture after switching variant. Active material is from the previously selected variant, as if call to variantName = 'desired-variant' should be replaced with async/await method call. async[$switchVariant](variantName: string|null) {
for (const primitive of this[$primitivesList]) {
await primitive.enableVariant(variantName);
}
... EDIT: Instead of using what is stated in the documentation modelViewer.variantName = 'desired-variant' promisify the statement await Promise.resolve(() => modelViewer.variantName = 'desired-variant'); or await (() => modelViewer.variantName = materialInstance.variant); However, it feels a a bit hacky. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I just updated to version 1.9.0. We have some animated parts in our models. When changing the GLTF material variant, some parts of the model now stay with the old texture.
The console throws this error:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'gltf')
at Zy.[getLoadedMaterial] (/js/ext/model-viewer.min.js:1204)
at async sx.setActiveMaterial (/js/ext/model-viewer.min.js:1204)
at async Promise.all (index 17)
at async bx.[switchVariant] (/js/ext/model-viewer.min.js:1219)
at async HTMLElement.updated (/js/ext/model-viewer.min.js:1248)
Is anyone else experiencing this?
Is it right to just change the .variantName attribute of the modelviewer to change material variant?
Best regards
Beta Was this translation helpful? Give feedback.
All reactions