Skip to content

Commit

Permalink
bugfix static asset hierarchy collapse
Browse files Browse the repository at this point in the history
  • Loading branch information
karhankayan committed Jan 7, 2025
1 parent 0c0d368 commit 34753ca
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions infinigen/assets/static_assets/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,11 @@ def collapse_hierarchy(root_obj):
mesh_objects = []

def process_object(obj, parent=None):
new_obj = obj
if obj.type != "MESH":
new_obj = create_empty_mesh_object(obj.name, parent)
new_obj.matrix_world = obj.matrix_world
else:
if parent:
new_obj.parent = parent
new_obj = create_empty_mesh_object(obj.name, parent)
new_obj.matrix_world = obj.matrix_world

if obj.type == "MESH":
new_obj.data = obj.data.copy()

mesh_objects.append(new_obj)

Expand All @@ -54,9 +52,9 @@ def process_object(obj, parent=None):

bpy.context.view_layer.objects.active = mesh_objects[0]
bpy.ops.object.join()

final_obj = bpy.context.active_object

# Delete the original hierarchy
butil.delete(list(butil.iter_object_tree(root_obj)))

return final_obj

0 comments on commit 34753ca

Please sign in to comment.