Hi!
I have a simple scene - one THREE.Object3D and a few OBJ models.
I want to convert data of the scene to JSON file and give to user possibilities to download this file.
Below is the code. This code works to a small objects but not in this case. It means - it works, file is download but i can’t opened it. I think - it’s too large and this is a problem.
function saveLikeJSON(){
var dataJSON = {scene: scene.children}
var dataJson = JSON.stringify(dataJSON); // // I try JSON.stringify(scene) but it is wrong solution too
downloadTextFile(dataJson,"p")
}
function downloadTextFile(text, name) {
const a = document.createElement('a');
const type = name.split(".").pop();
a.href = URL.createObjectURL( new Blob([text], { type:`text/${type === "txt" ? "plain" : type}` }) );
a.download = name;
a.click();
}
How download only nessesary information about the scene and convert they to json file?