Skip to content

Commit 011fb66

Browse files
committed
Add ALT+Click unhide to select_linked_aggregates
ALT+Click now unhides hidden objects (viewport and local hide) before selecting, matching the behavior added to other select operators. Generated with the assistance of an AI coding tool.
1 parent cd45878 commit 011fb66

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/bonsai/bonsai/bim/module/aggregate/operator.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,13 +407,18 @@ class BIM_OT_select_linked_aggregates(bpy.types.Operator):
407407
bl_label = "Select linked aggregates"
408408
bl_options = {"REGISTER", "UNDO"}
409409
select_parts: bpy.props.BoolProperty(default=False)
410+
should_unhide: bpy.props.BoolProperty(default=False, options={"SKIP_SAVE"})
410411

411412
@classmethod
412413
def description(cls, context, properties):
413414
if properties.select_parts:
414-
return "Select all aggregates, subaggregates and all their parts"
415+
return "Select all aggregates, subaggregates and all their parts\n\nALT+Click to also unhide hidden objects (viewport and local hide)"
415416
else:
416-
return "Select all aggregates"
417+
return "Select all aggregates\n\nALT+Click to also unhide hidden objects (viewport and local hide)"
418+
419+
def invoke(self, context, event):
420+
self.should_unhide = event.alt
421+
return self.execute(context)
417422

418423
def execute(self, context):
419424
for obj in context.selected_objects:
@@ -446,11 +451,18 @@ def execute(self, context):
446451
for element in parts_objs:
447452
obj = tool.Ifc.get_object(element)
448453
if obj:
454+
if self.should_unhide:
455+
obj.hide_viewport = False
456+
obj.hide_set(False)
449457
obj.select_set(True)
450458
else:
451459
for element in parts:
452460
obj = tool.Ifc.get_object(element)
453-
obj.select_set(True)
461+
if obj:
462+
if self.should_unhide:
463+
obj.hide_viewport = False
464+
obj.hide_set(False)
465+
obj.select_set(True)
454466

455467
return {"FINISHED"}
456468

0 commit comments

Comments
 (0)