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...
This commit is contained in:
Bastien Montagne 2019-02-06 21:46:44 +01:00
parent 16f675ceda
commit f541b292ef
Notes: blender-bot 2023-02-14 19:21:03 +01:00
Referenced by issue #60845, Export OBJ: error exporting as obj when file contains collection instances
2 changed files with 6 additions and 14 deletions

View File

@ -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",

View File

@ -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()