Recently, I've been attempting to export a three.js scene using the SceneExporter tool. Here is the code snippet I have been working with:
var output = new THREE.SceneExporter().parse(scope.renderingEngine.scene);
Unfortunately, this has resulted in an error message popping up during execution:
Uncaught SyntaxError: Unexpected token u
The error seems to originate from line 750 of SceneExporter.js, specifically where the JSON data is being parsed by
new THREE.SceneExporter().parse(scope.renderingEngine.scene);
I have kept my scene fairly simple without any complex elements and even tested it without textures, yet the error persists.
Upon further investigation, I tried modifying the problematic line to just return output
. However, when I attempt to stringify and save the output as a JSON file, the generated JSON does not validate and throws the following error:
Parse error on line 1:
"{ \n\t\"metadat
^
Expecting '{', '['
Here are lines 1-10 of the JSON file:
"{
\n\t\"metadata\": {
\n\t\t\"formatVersion\": 3.2,
\n\t\t\"type\"\t\t: \"scene\",
\n\t\t\"generatedBy\"\t: \"SceneExporter\",
\n\t\t\"objects\": 153,
\n\t\t\"geometries\": 144,
\n\t\t\"materials\": 5,
\n\t\t\"textures\": 1\n\t
},
\n\n\t\"urlBaseType\": \"relativeToScene\",
Has anyone else encountered a similar issue while working with three.js?