All my scene objects is created with a wireframe. When I export objects from the scene it works ok with the code bellow:
var objList = $this.getSceneObjects()
for (var i in objList) {
$this.savefile.scene.objects.push(objList[i].toJSON())
}
Then I put all objects together, store some more needed information and save in a whatever file. So my program will open this file, it's not an importation at all, it's an opening to keep editing objects... But when I try to do it, I get a lot of errors. That's my opening code:
var fileJson = JSON.parse(fs.readFileSync(file))
var document = new App.Document(file)
// Load Scene saved objects
var loader = new THREE.ObjectLoader();
for (var obj in fileJson.scene.objects) {
var item = fileJson.scene.objects[obj]
document.getScene().add(loader.parse(item))
}
Note in the image attached that none of the objects could be rendered with that wireframe I said before... =/
Seems like ObjectLoader
can't process EdgesGeometry
yet.
Does it work if you are not using EdgesGeometry
in your app?
Even without a test I would answer 'Yes' because to work around it I'm removing that from the object children and creating again as following code bellow. So yes, I guess the only one problem is the EdgesGeometry
:
// @todo: THREE.EdgesGeometry Fix
// Three js can not load EdgesGeometry for now
piece.children.splice(0, 1) // Remove wireframe
var edges = new THREE.EdgesGeometry(piece.geometry)
var wireframe = new THREE.LineSegments(edges, new THREE.LineBasicMaterial({
name: 'wireframe',
color: App.getColorContrast(piece.material.color.getHex())
}))
piece.add(wireframe)
Serialization/ deserialization of EdgesGeometry
is somewhat tricky since it has a geometry object as parameter. Let's label this issue as a feature request. For now, a workaround is to manually create EdgesGeometry
in your app when you load a scene. I know it's not a nice solution but it should work.
Thanks a lot! I'll be waiting for it with no problems. =)
@marcobraghim Can you please check if #14357 solves your issue?
Let me check it out =D
Yeah!! It works just fine for me. Thank you very much =D
=D
Thanks for testing!
why it's not being merged? i think it works. Or u guys give me some advice to make use of worker.
Closing in favor of #16340.