unlink pasted blender objects if there is no active ifc file #4619

This commit is contained in:
Andrej730
2024-05-06 15:03:27 +05:00
parent 6c313dd25c
commit 8f7f6223de
@@ -1446,14 +1446,13 @@ class OverridePasteBuffer(bpy.types.Operator):
def execute(self, context): def execute(self, context):
bpy.ops.view3d.pastebuffer() bpy.ops.view3d.pastebuffer()
if IfcStore.get_file(): for obj in context.selected_objects:
for obj in context.selected_objects: # Pasted objects may come from another Blender session, or even
# Pasted objects may come from another Blender session, or even # from the same session where the original object has since
# from the same session where the original object has since # been deleted. As the source element may not exist, paste will
# been deleted. As the source element may not exist, paste will # always unlink the element. If you want to duplicate an
# always unlink the element. If you want to duplicate an # element, use the duplicate commands.
# element, use the duplicate commands. tool.Root.unlink_object(obj)
tool.Root.unlink_object(obj)
return {"FINISHED"} return {"FINISHED"}