diff --git a/src/bonsai/bonsai/bim/module/spatial/operator.py b/src/bonsai/bonsai/bim/module/spatial/operator.py index f1eb4ec4ee..0a1b5134dd 100644 --- a/src/bonsai/bonsai/bim/module/spatial/operator.py +++ b/src/bonsai/bonsai/bim/module/spatial/operator.py @@ -284,14 +284,16 @@ class SelectContainer(bpy.types.Operator): class SelectSimilarContainer(bpy.types.Operator): bl_idname = "bim.select_similar_container" bl_label = "Select Similar Container" - bl_description = "Recurvisevly selects all objects in the container.\n\nCtrl+click to select only one level deep" + bl_description = "Recursively selects all objects in the container.\n\nCtrl+click to select only one level deep\nAlt+click to also unhide hidden objects (viewport and local hide)" bl_options = {"REGISTER", "UNDO"} is_recursive: bpy.props.BoolProperty(default=True) + should_unhide: bpy.props.BoolProperty(default=False, options={"SKIP_SAVE"}) def invoke(self, context, event): if event.type == "LEFTMOUSE" and event.ctrl: self.is_recursive = False + self.should_unhide = event.alt return self.execute(context) def execute(self, context): @@ -300,6 +302,7 @@ class SelectSimilarContainer(bpy.types.Operator): tool.Spatial, obj=context.active_object, is_recursive=self.is_recursive, + should_unhide=self.should_unhide, ) self.is_recursive = True # <-- forcibly reset return {"FINISHED"} diff --git a/src/bonsai/bonsai/core/spatial.py b/src/bonsai/bonsai/core/spatial.py index 5086a8a872..56c07f5e24 100644 --- a/src/bonsai/bonsai/core/spatial.py +++ b/src/bonsai/bonsai/core/spatial.py @@ -124,10 +124,13 @@ def select_similar_container( spatial: type[tool.Spatial], obj: bpy.types.Object, is_recursive: bool = True, + should_unhide: bool = False, ) -> None: element = ifc.get_entity(obj) if element: - spatial.select_products(spatial.get_decomposed_elements(spatial.get_container(element), is_recursive)) + spatial.select_products( + spatial.get_decomposed_elements(spatial.get_container(element), is_recursive), unhide=should_unhide + ) def select_product(spatial: type[tool.Spatial], product: ifcopenshell.entity_instance) -> None: diff --git a/src/bonsai/bonsai/tool/spatial.py b/src/bonsai/bonsai/tool/spatial.py index b185b9ab59..f69ed31dbc 100644 --- a/src/bonsai/bonsai/tool/spatial.py +++ b/src/bonsai/bonsai/tool/spatial.py @@ -200,6 +200,7 @@ class Spatial(bonsai.core.tool.Spatial): obj = tool.Ifc.get_object(product) if obj and view_layer.objects.get(obj.name): if unhide: + obj.hide_viewport = False obj.hide_set(False) obj.select_set(True)