From f541b292efd661313cf3f95ed68e4af8974c4e4b Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Wed, 6 Feb 2019 21:46:44 +0100 Subject: 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... --- io_scene_obj/__init__.py | 2 +- io_scene_obj/export_obj.py | 18 +++++------------- 2 files changed, 6 insertions(+), 14 deletions(-) (limited to 'io_scene_obj') 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() -- cgit v1.2.3