bim.override_paste_buffer - fix issue when ctrl-v might unlink currently selected ifc elements

This commit is contained in:
Andrej730
2025-02-11 14:52:36 +05:00
parent 77c2e626b3
commit 09abf0c7ab
@@ -1852,8 +1852,16 @@ class OverridePasteBuffer(bpy.types.Operator):
bl_options = {"REGISTER", "UNDO"}
def execute(self, context):
previously_selected_objects = set(context.selected_objects)
bpy.ops.view3d.pastebuffer()
# If object selection did not change, then there were no objects to paste.
# Then exist early to prevent unlinking previously selected objects.
pasted_objects = context.selected_objects
if previously_selected_objects == set(pasted_objects):
self.report({"INFO"}, "No objects to paste.")
return {"FINISHED"}
for obj in pasted_objects:
# Pasted objects may come from another Blender session, or even
# from the same session where the original object has since