In my project I use three in react (0.98) to render some json exported by blender 2.76 in order to produce images that I can modify with images in order on top of that to save the images and show them.
The entire process is called mockuprenderer.
Everything worked fine till the day that three js doesnt use anymore the objectloader and replace it with LegacyJSONloader. Unfortunately my problem is that there are no types relative to this loader and I need them because the project is written in typescript.
Do you have some solution for that?
That’s is not entirely correct. THREE.ObjectLoader is still available and you can use it to load JSON in the Object/Scene format. THREE.JSONLoader was removed with R99 from the core. It is now THREE.LegacyJSONLoader and part of the examples.
The problem is that you work with an exporter which was removed from the project almost a year ago. Because of this, you still need to work with THREE.LegacyJSONLoader. Have you considered to switch to a glTF based workflow instead?
I don’t think there will be type definitions for deprecated classes from the official side. You might want to use the following type definitions from another project. However, a few methods are missing (.setPath(), .setResourcePath() and .setCrossOrigin()).
Hi Mugen87 thanks for the answer, you re totally right. It’s just that now redo all the project basing the thing on gtlf files is a little bit crazy. I have to review the entire project. so you think three js will not provide types in the future for LegacyJSONloader and because of this I should pass to gltf ?
Yes. But it’s not only about the types. Using glTF is the more robust and future-proof workflow. It’s also the recommended 3D format of the project. More details here:
hello i am working with legacyJSONLoader and when i write this line of code <‘import * as THREE from’ https://threejs.org/build/three.module.js’ this error appears "Uncaught TypeError: THREE.LegacyJSONLoader is not a constructor " any suggestion please
LegacyJSONLoader was removed with r111. You can’t use the loader anymore with recent three.js versions. I highly recommend that you change your workflow towards glTF.
thank u , i have a JSON file i try with three js editor but does’nt work and also i go back to r110 nothing work too , is there another method to convert JSON file to GLTF? gym-ceiling.js (514.5 KB)
gym-ceiling.js has 256 different materials. You have to change the color property of all materials to see the effect that you want.
BTW: This type of model design is highly inefficient especially since all 256 material seems to have the same properties. I suggest you import the glb file into Blender, merge all parts of the geometry into a single entity, adjust the color and then export to glb again.
Hello, have u any Idea about GltfExporter because the same problème appears with GltfExporter when i add ‘import * as …’ he don’t work, any suggestions !
Import your old json file using File > Import and then export it using File > Export GLB - nice!
However, this does not appear to work with rigging or animations - it just exports a static model so you may need to re-rig and animate your old assets