Material Variants data is missing from mesh userData after updating to r133

Hi, after updating to 133 the GLTF parser is not adding the material variants data to the userData object of the mesh. In previous versions I was able to access the data in userData.variantMaterials. In my application I’m using this to guess which meshes need to be updated inside a traverse of the scene. Any ideas?

Thanks in advance guys!

So it worked with r132 but not with r133?

I’m not sure I can remember userData.variantMaterials. Do you mind sharing a complete code example that shows what you are doing?

@Mugen87 Thanks for the response.

I forgot to mention that I’m using three-gltf-extensions to add the material variants extension to the GLTF Loader.

You can see a live example here:

Check the console output to see the results. To switch version just edit the import map data to 0.133.1 on both, three and the loader.

I’m not sure but i think maybe this PR changes could be the cause

Thanks in advance!

You probably want to file an issue at the GitHub - takahirox/three-gltf-extensions: Unofficial Three.js glTF loader/exporter plugins repository so the previous behavior is restored with latest three.js version.

Changing GLTFLoader to restore the features of a third-party library is not appropriate.

1 Like

Or you just refactor your code and use the built-in material variants support:

Ok. Thanks @Mugen87.

I have found that the changes to match r133 are already in the master branch of three-gltf-extensions but the release was not created and the npm package version is obsolete.

My solution was to pull the package directly from github repo to have the latest changes.

"three-gltf-extensions": "git+"
1 Like