Fix #4494 - Be able to search (select objects in scene) from the Spreadsheet Import/Export UI, as well.

This commit is contained in:
Ryan Schultz
2024-07-06 11:43:39 -05:00
parent 9d11f8a25b
commit 410fff6ee9
3 changed files with 16 additions and 2 deletions
@@ -87,6 +87,11 @@ class BIM_PT_ifccsv(Panel):
blenderbim.bim.helper.draw_filter(self.layout, props.filter_groups, SearchData, "csv") blenderbim.bim.helper.draw_filter(self.layout, props.filter_groups, SearchData, "csv")
row = layout.row(align=True)
op = row.operator("bim.search", text="Select", icon="VIEWZOOM")
op.property_group = "CsvProperties"
layout.separator()
row = layout.row(align=True) row = layout.row(align=True)
row.operator("bim.add_csv_attribute", icon="ADD") row.operator("bim.add_csv_attribute", icon="ADD")
row.prop(props, "should_show_sort", icon="SORTSIZE", text="") row.prop(props, "should_show_sort", icon="SORTSIZE", text="")
@@ -123,3 +128,6 @@ class BIM_PT_ifccsv(Panel):
row = layout.row(align=True) row = layout.row(align=True)
row.operator("bim.export_ifccsv", icon="EXPORT", text="Export IFC to " + props.format.upper()) row.operator("bim.export_ifccsv", icon="EXPORT", text="Export IFC to " + props.format.upper())
row.operator("bim.import_ifccsv", icon="IMPORT") row.operator("bim.import_ifccsv", icon="IMPORT")
@@ -168,8 +168,13 @@ class Search(Operator):
bl_idname = "bim.search" bl_idname = "bim.search"
bl_label = "Search" bl_label = "Search"
property_group: bpy.props.StringProperty(name="Property Group", default="")
def execute(self, context): def execute(self, context):
props = context.scene.BIMSearchProperties if self.property_group == "CsvProperties":
props = context.scene.CsvProperties
elif self.property_group == "BIMSearchProperties":
props = context.scene.BIMSearchProperties
results = ifcopenshell.util.selector.filter_elements( results = ifcopenshell.util.selector.filter_elements(
tool.Ifc.get(), tool.Search.export_filter_query(props.filter_groups) tool.Ifc.get(), tool.Search.export_filter_query(props.filter_groups)
) )
@@ -40,7 +40,8 @@ class BIM_PT_search(Panel):
if len(props.filter_groups): if len(props.filter_groups):
row = self.layout.row(align=True) row = self.layout.row(align=True)
row.operator("bim.search", text="Search", icon="VIEWZOOM") op = row.operator("bim.search", text="Search", icon="VIEWZOOM")
op.property_group = "BIMSearchProperties" # Pass property group name
return return