Add ALT+Click unhide to select_similar_container

ALT+Click now unhides hidden objects (viewport and local
hide) before selecting. Also fixes select_products to set
hide_viewport in addition to hide_set when unhiding.

Generated with the assistance of an AI coding tool.
This commit is contained in:
Ryan Schultz
2026-03-20 18:54:43 -05:00
parent ea27b4f3ae
commit 873f9f061f
3 changed files with 9 additions and 2 deletions
@@ -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"}
+4 -1
View File
@@ -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:
+1
View File
@@ -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)