three.js icon indicating copy to clipboard operation
three.js copied to clipboard

Blender Exporter does not export groups properly?

Open mkschreder opened this issue 12 years ago • 6 comments

There is something weird going on with the blender exporter. Running on blender 2.69. Almost completely randomly some embedded meshes either disappear or are exported with wrong names. For instance, embedded mesh ending with 002 below is not even present in the geometries array. And some meshes in the geometries array that should be exported, are not present in the embeds array.

"geometries" :
{
    "geo_Cube.003" : {
        "type" : "embedded",
        "id"  : "emb_Cube.003"
    },

    "geo_Cube.001" : {
        "type" : "embedded",
        "id"  : "emb_Cube.001"
    },

    "geo_Cube.000" : {
        "type" : "embedded",
        "id"  : "emb_Cube.000"
    },

    "geo_Cube.005" : {
        "type" : "embedded",
        "id"  : "emb_Cube.005"
    },

    "geo_Cube.004" : {
        "type" : "embedded",
        "id"  : "emb_Cube.004"
    }
},

"embeds" :
{
"emb_Cube.002": {   "scale" : 1.000000,

},

"emb_Cube.001": {   "scale" : 1.000000,

},

"emb_Cube.000": {   "scale" : 1.000000,

},

"emb_Cube.005": {   "scale" : 1.000000,
...
}

mkschreder avatar Feb 19 '14 06:02 mkschreder

Found the problem. Must use "object.name" in places where you use "object.data.name" in the blender exporter. Otherwise you get wrong data. When I switched out object.data.name to object.name I was able to export scenes correctly.

mkschreder avatar Feb 19 '14 08:02 mkschreder

As an additional note: I had the same problem because I renamed my cameras and had to make this change. for cameraobj in cams:

  •   camera = bpy.data.cameras[cameraobj.name]
    
  •  camera = bpy.data.cameras[cameraobj.data.name]
    

repsac avatar Feb 19 '14 15:02 repsac

Do you guys mind doing a PR that fixes this?

mrdoob avatar Feb 19 '14 18:02 mrdoob

@mrdoob actually (wasn't going to announce it for another week or so) I am in the middle of re-writing the entire exporter API (scalable, re-usable API across multiple applications, actual JSON serialization, unit tests, etc). In this I was going to patch these Blender bugs.

repsac avatar Feb 19 '14 19:02 repsac

With that said, I can do a PR on this since the fixes are small and quick

repsac avatar Feb 19 '14 19:02 repsac

A rewrite sounds great! But yeah, for such a "small" fix it would be good to have a PR and let the rewrite take its time.

mrdoob avatar Feb 19 '14 19:02 mrdoob