From 74390c0529f5e5a1c64efa3140a1c2a27be63261 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Fri, 18 Apr 2025 18:28:09 +1000 Subject: [PATCH] Fix bug where duplication outside IFC projects didn't use native Blender operators. Historically we overrode the operator, so we had to reinvent native functionality. Now we only override the hotkey, so we can reuse native functionality. This also means that things we failed to reinvent like duplicating unlinked animation data now works properly. This bit me when I was doing animation work and Bonsai's duplicate messed things up. --- .../bonsai/bim/module/geometry/operator.py | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/geometry/operator.py b/src/bonsai/bonsai/bim/module/geometry/operator.py index 9bc9273fa7..70121aa88e 100644 --- a/src/bonsai/bonsai/bim/module/geometry/operator.py +++ b/src/bonsai/bonsai/bim/module/geometry/operator.py @@ -969,19 +969,10 @@ class OverrideDuplicateMove(bpy.types.Operator): context.view_layer.objects.active = self.new_active_obj return {"FINISHED"} - new_active_obj = None - for obj in context.selected_objects: - new_obj = obj.copy() - if obj.data and not linked: - new_obj.data = obj.data.copy() - if obj == context.active_object: - new_active_obj = new_obj - for collection in obj.users_collection: - collection.objects.link(new_obj) - obj.select_set(False) - new_obj.select_set(True) - if new_active_obj: - context.view_layer.objects.active = new_active_obj + if linked: + bpy.ops.object.duplicate_move_linked() + else: + bpy.ops.object.duplicate_move() return {"FINISHED"} @staticmethod