Default Loading Manager is not running for some fbx models

Hi

I have an input box of type file and whenever user selects file along with its texture, I read the file one by one using FileReader.

const reader = new FileReader();

reader.readAsArrayBuffer(file);

After that I am using FBXLoader to parse that file.

const loader = new FBXLoader()

 const object = loader.parse(
        response.target.result,
        ''
  )

I have setup a default loading manager callback which sends me the progress while model is parsing.

THREE.DefaultLoadingManager.onProgress = function (item, loaded, total) {
    // All textures are finished loading when loaded === total
    if (loaded === total && object && !resolved) {
        resolved = true
        return self.loadTextures(object, textureFiles)
     }
 };

Once model gets loaded, I am calling a function “loadTextures” to load its textures which uses TextureLoader.

For some models, callback is running, but for some its not.
Here is the link of the file for which its not working.

Another question:-
How can we know if the fbx model files has texture embedded?

(1) Afaik calling FBXLoader.parse directly on a loaded model will not cause either onProgress or onLoad to be called. These are called via a FileLoader (which is not created, unless you use FBXLoader.load.)

Why some models do call onProgress for you and some don’t probably depends on whether they have textures or not. Parsing FBX directly will create a TextureLoader which then can fire these progress events.

How can we know if the fbx model files has texture embedded?

(2) After FBX is parsed, you can see if it has any textures by checking if fbx.Objects.Texture is defined (similarly as it’s done in the parser.)

After parsing, I get the following object:-

There is no “Object” property. Neither in the model which has embedded textures nor in the model without textures.

Would you please elaborate a little more.

Yeah, that wasn’t clear, my bad - what I meant wasn’t the entire model parsed, just the file. Take a look how fbxTree object is initialized here. fbxTree is a parsed file, but not yet a parsed model - and it does include the information you’re looking for.

Thank you @mjurczyk
I Got it!
But does three.js give export to these helper functions and parsers so then I can check or create fbx tree in my angular code?
Or Do I have to copy the entire code of fbx tree, generate it and then check for textures?

Do you have any code examples?