diff --git a/src/bonsai/bonsai/bim/helper.py b/src/bonsai/bonsai/bim/helper.py index 978fe02b30..0e914084aa 100644 --- a/src/bonsai/bonsai/bim/helper.py +++ b/src/bonsai/bonsai/bim/helper.py @@ -52,6 +52,7 @@ def draw_attributes( copy_operator: Optional[str] = None, popup_active_attribute: Optional[bonsai.bim.prop.Attribute] = None, callback: Optional[Callable[[bonsai.bim.prop.Attribute, bpy.types.UILayout], None]] = None, + *, enable_search: bool = False, ) -> None: """Draw editable UI for prop.Attributes. diff --git a/src/bonsai/bonsai/bim/module/attribute/ui.py b/src/bonsai/bonsai/bim/module/attribute/ui.py index 1e719cba07..d0b109a7a8 100644 --- a/src/bonsai/bonsai/bim/module/attribute/ui.py +++ b/src/bonsai/bonsai/bim/module/attribute/ui.py @@ -38,7 +38,9 @@ def draw_ui(context: bpy.types.Context, layout: bpy.types.UILayout, attributes) row.operator("bim.edit_attributes", icon="CHECKMARK", text="Save Attributes") row.operator("bim.disable_editing_attributes", icon="CANCEL", text="") - bonsai.bim.helper.draw_attributes(props.attributes, layout, copy_operator="bim.copy_attribute_to_selection") + bonsai.bim.helper.draw_attributes( + props.attributes, layout, copy_operator="bim.copy_attribute_to_selection", enable_search=True + ) else: row = layout.row() op = row.operator("bim.enable_editing_attributes", icon="GREASEPENCIL", text="Edit") @@ -121,7 +123,7 @@ class BIM_PT_explorer(Panel): row = box.row(align=True) row.operator("bim.explorer_edit_entity", icon="CHECKMARK") row.operator("bim.explorer_disable_editing_entity", icon="CANCEL", text="") - bonsai.bim.helper.draw_attributes(props.entity_attributes, box) + bonsai.bim.helper.draw_attributes(props.entity_attributes, box, enable_search=True) class BIM_UL_explorer(bpy.types.UIList): diff --git a/src/bonsai/bonsai/bim/module/profile/ui.py b/src/bonsai/bonsai/bim/module/profile/ui.py index ba3e95ac06..33b8ca7d58 100644 --- a/src/bonsai/bonsai/bim/module/profile/ui.py +++ b/src/bonsai/bonsai/bim/module/profile/ui.py @@ -140,7 +140,7 @@ class BIM_PT_profiles(Panel): self.draw_editable_ui(context) def draw_editable_ui(self, context): - bonsai.bim.helper.draw_attributes(self.props.profile_attributes, self.layout) + bonsai.bim.helper.draw_attributes(self.props.profile_attributes, self.layout, enable_search=True) class BIM_UL_profiles(UIList): diff --git a/src/bonsai/bonsai/bim/module/style/ui.py b/src/bonsai/bonsai/bim/module/style/ui.py index a4c68fa7a4..37c46b6d63 100644 --- a/src/bonsai/bonsai/bim/module/style/ui.py +++ b/src/bonsai/bonsai/bim/module/style/ui.py @@ -135,7 +135,7 @@ class BIM_PT_styles(Panel): # display style elements props during edit if self.props.is_editing_style: if self.props.is_editing_class == "IfcSurfaceStyle": - bonsai.bim.helper.draw_attributes(self.props.attributes, self.layout) + bonsai.bim.helper.draw_attributes(self.props.attributes, self.layout, enable_search=True) edit_label = "Save Attributes" elif self.props.is_editing_class == "IfcSurfaceStyleShading": self.draw_surface_style_shading() @@ -246,10 +246,10 @@ class BIM_PT_styles(Panel): op = row.operator("bim.browse_external_style", icon="APPEND_BLEND", text="Append From Blend File") style = self.props.active_style op.active_surface_style_id = style.ifc_definition_id - bonsai.bim.helper.draw_attributes(self.props.external_style_attributes, self.layout) + bonsai.bim.helper.draw_attributes(self.props.external_style_attributes, self.layout, enable_search=True) def draw_refraction_surface_style(self): - bonsai.bim.helper.draw_attributes(self.props.refraction_style_attributes, self.layout) + bonsai.bim.helper.draw_attributes(self.props.refraction_style_attributes, self.layout, enable_search=True) row = self.layout.row(align=True) def draw_lighting_surface_style(self): diff --git a/src/bonsai/bonsai/bim/operator.py b/src/bonsai/bonsai/bim/operator.py index 24b9d3a3bb..f769179934 100644 --- a/src/bonsai/bonsai/bim/operator.py +++ b/src/bonsai/bonsai/bim/operator.py @@ -1373,6 +1373,9 @@ class BIM_OT_attribute_search_values(bpy.types.Operator): return attr_name, attribute_obj def invoke(self, context, event): + required_props = (self.attribute_name, self.attribute_ifc_class, self.data_path) + assert all(required_props), required_props + attr_name, attribute_obj = self.resolve_data_path(self.data_path) self.search_value = str(getattr(attribute_obj, attr_name, ""))