Three.js: FBXLoader.js bug and resolvement in v119

Created on 30 Jul 2020  路  9Comments  路  Source: mrdoob/three.js

examples/js/loaders/FBXLoader.js L3554

var inflate = new Inflate( new Uint8Array( reader.getArrayBuffer( compressedLength ) ) );
->
var inflate = new Zlib.Inflate( new Uint8Array( reader.getArrayBuffer( compressedLength ) ) );

Otherwise Inflate can not be found.
jimver

Regression

Most helpful comment

Thank you for pinging @Mugen87 and thank you for bringing attention to this @jimver04.

I had tested the behavior of FBX and all of the other loaders involved in that PR, everything appeared normal. But it is possible I've missed something. I'll run a few tests to determine if we should revert those changes.

All 9 comments

Possibly introduced with #19748.

/cc @sciecode

Thank you for pinging @Mugen87 and thank you for bringing attention to this @jimver04.

I had tested the behavior of FBX and all of the other loaders involved in that PR, everything appeared normal. But it is possible I've missed something. I'll run a few tests to determine if we should revert those changes.

@jimver04 Any chances to share your FBX file in this thread for testing?

Send me your email: jimver04 at gmail.com

Perhaps it is because I am using "Three.js" but not "Three.module.js" ???

fbx Exported as binary from Blender 2.83.2 but some parts of it are not mine and I can not share in the thread. I can send you via email : jimver04 at gmail.com

Perhaps it is because I am using "Three.js" but not "Three.module.js" ???

It is a possibility, even though I remember testing the non-modular variant as well.

I have reached you through email, you may remove your contact info if you wish to avoid spams and unwanted emails.

I wasn't able to reproduce any problems on FBX/VTK/EXR loaders with either the modular or non-modular variants of the inflate/deflate libs. However I have an idea as to what could be your problem.

FBXLoader specifically displays a warning when failing to locate the Inflate.js library:

THREE.FBXLoader: External library Inflate.min.js required, obtain or import from https://github.com/imaya/zlib.js

However, since https://github.com/mrdoob/three.js/pull/19748, our inflate API has changed. Using the links lib version will no longer work properly. You must use three.js dev distribution version inflate.min.js.

I believe this might solve your issue, but we could perhaps update these warnings in both FBX and EXR loaders just in case.

( or study different alternatives as discussed on the PR )

Sciecode I didn't find your email but you have right:

I downloaded inflate.min.js from https://github.com/imaya/zlib.js/bin/
as prompted by the warning which actually led me to wrong version of Inflate

However, the version inside Three.js is the one that works with both "new Inflate" (also works with new Zlib.Inflate)
It has an extra line in the end: var Inflate = Zlib.Inflate; which makes both classes equal, no idea why.

So to conclude and close the issue:

The warning at FBXLoader.js ~L3550 should be replaced as follows

THREE.FBXLoader: External library Inflate.min.js required, obtain or import from https://github.com/imaya/zlib.js

->
THREE.FBXLoader: External library Inflate.min.js required, obtain or import from https://github.com/mrdoob/three.js/blob/dev/examples/js/libs/inflate.min.js

or make the change at FBXLoader.js L3554 , i.e. replace Inflate with Zlib.Inflate
and also remove the last line from Inflate.min.js (of Three.js) namely "var Inflate = Zlib.Inflate;"

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jlaquinte picture jlaquinte  路  3Comments

fuzihaofzh picture fuzihaofzh  路  3Comments

makc picture makc  路  3Comments

zsitro picture zsitro  路  3Comments

scrubs picture scrubs  路  3Comments