The filter search field now also filters description and predefined type

This commit is contained in:
Gorgious56
2025-01-13 09:28:56 +01:00
parent 68f175fc71
commit 9eaf41c9f0
2 changed files with 11 additions and 1 deletions
+10 -1
View File
@@ -138,9 +138,18 @@ class AuthoringData:
@classmethod
def type_elements_filtered(cls):
search_query = cls.props.search_name.lower()
def filter_element(element):
if search_query in (element.Name or "Unnamed").lower():
return True
if search_query in (element.Description or "").lower():
return True
if search_query in ifcopenshell.util.element.get_predefined_type(element).lower():
return True
return False
elements = cls.data["type_elements"]
if cls.props.search_name:
return [e for e in elements if cls.props.search_name.lower() in (e.Name or "Unnamed").lower()]
return [e for e in elements if filter_element(e)]
return elements
@classmethod
+1
View File
@@ -115,6 +115,7 @@ class LaunchTypeManager(bpy.types.Operator):
row.operator("bim.launch_add_element", text=f"Create New {AuthoringData.data['ifc_element_type']}", icon="ADD")
row = self.layout.row(align=True)
# row.prop(props, "relating_type_id", text="")
row.prop(props, "search_name", icon="FILTER", text="")
columns = self.layout.column_flow(columns=3)