Also just made a PR to three to ensure files at least load, not cause an exception
(but animations won’t load until the relevant PRs are merged as well)
mrdoob:dev
← needle-tools:prevent-load-exception-for-anim-pointer
opened 09:59AM - 10 Oct 22 UTC
Related issue: #24108
**Description**
Unfortunately there hasn't been much… movement on merging my PRs for `KHR_animation_pointer` (#24252, #24193 in preparation for #24108). In the meantime, people have starting using the extension and are bringing files to three.js that then fail with an exception.
This PR fixes the exception and makes sure people can at least load files that have `KHR_animation_pointer` marked as optional extension (according to glTF spec: when an extension is marked as optional implementations are fine to ignore it but should still display the rest of the file).
An open question would be whether to return "null" AnimationClips, thus potentially breaking external code that assumes that whenever an animation is loaded an AnimationClip is returned, or returning a clip with no tracks:
```
return new AnimationClip( animationName, undefined, [] );
```
I went with the latter here. There will be a log in the console that the extension isn't supported and people get empty tracks back instead of the current exception that looks like this:
![image](https://user-images.githubusercontent.com/2693840/194841196-418e984f-9034-4b20-8254-e4e8c06caf68.png)
My preference would definitely be KHR_animation_pointer support in three but in the meantime at least it shouldn't crash anymore for people.
*This contribution is funded by [Needle](https://needle.tools)*
merged the Needle GLTF loader, it’s fixed the Animator Component causing errors
by user 617973759852281873
are there any other bits you think need merging?
by user 617973759852281873
I’ve noticed now and then the textures for models are missing on import, for Blender too. Will do some investigation / start a new question
by user 617973759852281873
depends on your materials for export
also if you’re compressing files (e.g. do a production build and take those glbs) then Blender won’t be able to load them - doesn’t support importing KTX2 textures and compressed meshes right now as far as I’m aware
It was the materials thanks
by user 617973759852281873
If you want maximum glTF compatibility, I recommend using the UnityGltf/PBRGraph materials - pretty extensive support for glTF extensions
And no “guessing” of how it will come out, 1:1 mapping between Unity material properties and glTF properties
having a looky
by user 617973759852281873