feat : ✨ resolve [TODO] - provide file size of imported mesh
Hi @brianzinn
while I use model's onProgress or sceneLoader.Context's progress, I found an unresolved TODO feature that loads a correct file size
So, I resolve this in a simple way let me show you the before and after video
before it was modified, GUI progress had not correct length and not the total length ( written as 10000) when importing asset file
https://user-images.githubusercontent.com/70849655/164709710-99a56d35-32d2-4ff9-9565-04349cfb3e99.mp4
and after modified, GUI progress run correctly
https://user-images.githubusercontent.com/70849655/164709833-ccb4d7e5-22d8-4316-a941-0d1e517b723a.mp4
if there is any issue, please let know me
hi @slash9494 It's definitely a pain when the file size isn't known and you want to show the progress. Are you downloading the entire file (await fetch ...) to get the file size? Can you perhaps share the calling code as it's not quite clear how this works - thanks!
yes, what i tried to do was to get entire file size from local asset path
I thought it was unusual to import large files from a local environment But, I tried to test with a file that has size as big as possible
So,I tested with two files one of them is from gltf-sample-models https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/MosquitoInAmber/glTF-Binary
and another is from sketchfab https://skfb.ly/o6vrn
- it can be downloaded for free
on storybook, i just change baseUrl of ScaledModelWithProgress with localUrl

so, in useSceneLoader ,the below code is executed

and I figure out if sceneFilename of ScaleModelWithProgress is not declared, the above code does not execute
so, i commit one more for this with catching error
Sorry @slash9494 I still do not follow. Are you not downloading the asset twice by fetching again in the callback?
yes, you're right. the previous way was not good enough. so I fix a little bit more
I change cache control of fetching for getting file data from disk memory
So after requesting a file in sceneLoader.importMesh, if that is a static asset file, load from disk-memory inonProgress without any request

I feel that this way would be better
Ok - I’ll need to check how it runs after my vacation - May 16. I just need to see if on the first try it will load twice. Otherwise it would need to be an opt-in mechanism - also Babylon.js has built-in caching if you are continuously loading same mesh.