From 2ce5ddc10b1d752fd7f6c7b85883f9827a06f94c Mon Sep 17 00:00:00 2001 From: Ryan Schultz Date: Thu, 20 Aug 2026 11:09:44 -0500 Subject: [PATCH] Bonsai: duplicate-drawing share toggle only preserves already-shared annotations The "Share Annotations" toggle shared every manual annotation on the source drawing, which surprised users - a note unique to that drawing shouldn't silently become a shared element on the copy. It now preserves existing sharing only: an annotation already assigned to more than one drawing stays shared with the duplicate, while annotations unique to this drawing (and auto-generated tags) are still duplicated into independent copies. The toggle is renamed "Keep Shared Annotations Shared" to match. Co-Authored-By: Claude Opus 4.8 --- src/bonsai/bonsai/bim/module/drawing/operator.py | 7 ++++--- src/bonsai/bonsai/core/drawing.py | 16 ++++++++++------ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/bonsai/bonsai/bim/module/drawing/operator.py b/src/bonsai/bonsai/bim/module/drawing/operator.py index 2b2606c0e0..c31f8e9d57 100644 --- a/src/bonsai/bonsai/bim/module/drawing/operator.py +++ b/src/bonsai/bonsai/bim/module/drawing/operator.py @@ -203,10 +203,11 @@ class DuplicateDrawing(bpy.types.Operator, tool.Ifc.Operator): drawing: bpy.props.IntProperty() should_duplicate_annotations: bpy.props.BoolProperty(name="Should Duplicate Annotations", default=False) share_annotations: bpy.props.BoolProperty( - name="Share Annotations", + name="Keep Shared Annotations Shared", description=( - "Assign the same annotations to the new drawing (shared - editing one updates both) " - "instead of creating independent copies. Auto-generated tags are always copied" + "Annotations already shared across multiple drawings stay shared with the new drawing " + "(editing one updates both) instead of being copied. Annotations unique to this drawing " + "are still duplicated" ), default=False, ) diff --git a/src/bonsai/bonsai/core/drawing.py b/src/bonsai/bonsai/core/drawing.py index 7da52fc61a..5591f57f35 100644 --- a/src/bonsai/bonsai/core/drawing.py +++ b/src/bonsai/bonsai/core/drawing.py @@ -370,12 +370,16 @@ def duplicate_drawing( if should_duplicate_annotations: source_annotations = [a for a in drawing_tool.get_group_elements(group) if a != drawing] if share_annotations: - # Share manual annotations with the new drawing (multi-group membership): - # the same entity now belongs to both drawings' groups, so edits propagate. - # Auto-generated tags (grid/section/storey) can't be shared - they are - # regenerated per drawing - so they are still duplicated. - to_share = [a for a in source_annotations if not drawing_tool.is_auto_annotation(a)] - to_duplicate = [a for a in source_annotations if drawing_tool.is_auto_annotation(a)] + # Preserve existing sharing: an annotation that already appears on more + # than one drawing stays shared with the duplicate (the same entity is + # added to the new drawing's group, so edits keep propagating). Annotations + # unique to this drawing - and auto-generated tags - are duplicated as usual. + to_share = [ + a + for a in source_annotations + if not drawing_tool.is_auto_annotation(a) and len(drawing_tool.get_annotation_drawings(a)) > 1 + ] + to_duplicate = [a for a in source_annotations if a not in to_share] if to_share: ifc.run("group.assign_group", group=new_group, products=to_share) else: