bim.attribute_search_values - enable it in more places

Since this feature can be generally useful, let's try it out to see the cases when it should be disabled.

Additionally to Materials UI, it's now enabled in object attributes, materials, profiles, styles and explorer ui.
This commit is contained in:
Andrej730
2025-07-09 17:42:38 +05:00
parent 9649c23a3b
commit 1b1a1f143a
5 changed files with 12 additions and 6 deletions
+1
View File
@@ -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.
+4 -2
View File
@@ -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):
+1 -1
View File
@@ -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):
+3 -3
View File
@@ -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):
+3
View File
@@ -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, ""))