[Bf-extensions-cvs] [f541b292] master: Fix T60845: Export OBJ: error exporting as obj when file contains collection instances.

Bastien Montagne noreply at git.blender.org
Wed Feb 6 21:47:42 CET 2019


Commit: f541b292efd661313cf3f95ed68e4af8974c4e4b
Author: Bastien Montagne
Date:   Wed Feb 6 21:46:44 2019 +0100
Branches: master
https://developer.blender.org/rBAf541b292efd661313cf3f95ed68e4af8974c4e4b

Fix T60845: Export OBJ: error exporting as obj when file contains collection instances.

Looks like that was skipped somehow when OBJ IO was ported to 2.8...

===================================================================

M	io_scene_obj/__init__.py
M	io_scene_obj/export_obj.py

===================================================================

diff --git a/io_scene_obj/__init__.py b/io_scene_obj/__init__.py
index 84bddf9d..1ae4a8bf 100644
--- a/io_scene_obj/__init__.py
+++ b/io_scene_obj/__init__.py
@@ -21,7 +21,7 @@
 bl_info = {
     "name": "Wavefront OBJ format",
     "author": "Campbell Barton, Bastien Montagne",
-    "version": (3, 5, 7),
+    "version": (3, 5, 8),
     "blender": (2, 80, 0),
     "location": "File > Import-Export",
     "description": "Import-Export OBJ, Import OBJ mesh, UV's, materials and textures",
diff --git a/io_scene_obj/export_obj.py b/io_scene_obj/export_obj.py
index 17920c2a..34a279f4 100644
--- a/io_scene_obj/export_obj.py
+++ b/io_scene_obj/export_obj.py
@@ -325,20 +325,15 @@ def write_file(filepath, objects, depsgraph, scene,
             for i, ob_main in enumerate(objects):
                 # ignore dupli children
                 if ob_main.parent and ob_main.parent.instance_type in {'VERTS', 'FACES'}:
-                    # XXX
                     subprogress1.step("Ignoring %s, dupli child..." % ob_main.name)
                     continue
 
                 obs = [(ob_main, ob_main.matrix_world)]
-                if ob_main.instance_type != 'NONE':
-                    # XXX
-                    print('creating dupli_list on', ob_main.name)
-                    ob_main.dupli_list_create(scene)
-
-                    obs += [(dob.object, dob.matrix) for dob in ob_main.dupli_list]
-
-                    # XXX debug print
-                    print(ob_main.name, 'has', len(obs) - 1, 'dupli children')
+                if ob_main.is_instancer:
+                    obs += [(dup.instance_object.original, dup.matrix_world.copy())
+                            for dup in depsgraph.object_instances
+                            if dup.parent and dup.parent.original == ob_main]
+                    # ~ print(ob_main.name, 'has', len(obs) - 1, 'dupli children')
 
                 subprogress1.enter_substeps(len(obs))
                 for ob, ob_mat in obs:
@@ -644,9 +639,6 @@ def write_file(filepath, objects, depsgraph, scene,
                         # clean up
                         bpy.data.meshes.remove(me)
 
-                if ob_main.instance_type != 'NONE':
-                    ob_main.dupli_list_clear()
-
                 subprogress1.leave_substeps("Finished writing geometry of '%s'." % ob_main.name)
             subprogress1.leave_substeps()



More information about the Bf-extensions-cvs mailing list