From e1c1b828ad5556a8fa37d4531f22103e033d4f81 Mon Sep 17 00:00:00 2001 From: Ryan Schultz Date: Tue, 3 Jun 2025 07:29:19 -0500 Subject: [PATCH] Have save/cancel filter on top as well--helps with long filters. --- src/bonsai/bonsai/bim/helper.py | 11 ++++++++++- src/bonsai/bonsai/bim/module/drawing/operator.py | 11 ++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/bonsai/bonsai/bim/helper.py b/src/bonsai/bonsai/bim/helper.py index 1806e102d4..62ded9d241 100644 --- a/src/bonsai/bonsai/bim/helper.py +++ b/src/bonsai/bonsai/bim/helper.py @@ -411,7 +411,16 @@ def draw_filter( if data.data["saved_searches"]: row.operator("bim.load_search", text="", icon="IMPORT").module = module row.operator("bim.save_search", text="", icon="EXPORT").module = module - + if module != 'search': + if module == 'drawing_include': + row.operator("bim.edit_element_filter", icon="CHECKMARK", text="").filter_mode = ( + "INCLUDE" + ) + if module == 'drawing_exclude': + row.operator("bim.edit_element_filter", icon="CHECKMARK", text="").filter_mode = ( + "EXCLUDE" + ) + row.operator("bim.enable_editing_element_filter", icon="CANCEL", text="").filter_mode = "NONE" row = layout.row(align=True) row.operator("bim.add_filter_group", text="Add Search Group", icon="ADD").module = module row.operator("bim.edit_filter_query", text="", icon="FILTER").module = module diff --git a/src/bonsai/bonsai/bim/module/drawing/operator.py b/src/bonsai/bonsai/bim/module/drawing/operator.py index 862c0530f8..8c5a103746 100644 --- a/src/bonsai/bonsai/bim/module/drawing/operator.py +++ b/src/bonsai/bonsai/bim/module/drawing/operator.py @@ -3470,12 +3470,16 @@ class SelectAssignedProduct(bpy.types.Operator, tool.Ifc.Operator): class EnableEditingElementFilter(bpy.types.Operator, tool.Ifc.Operator): bl_idname = "bim.enable_editing_element_filter" - bl_label = "Enable Editing Element Filter" - bl_description = "Enable editing options for the include or exclude filter" - + bl_label = "Element Filter Mode" bl_options = {"REGISTER", "UNDO"} filter_mode: bpy.props.StringProperty() + @classmethod + def description(cls, context, properties): + if properties.filter_mode == 'NONE': + return "Cancel filter" + return "Enable editing options for the include or exclude filter" + def _execute(self, context): assert context.scene obj = context.scene.camera @@ -3497,6 +3501,7 @@ class EnableEditingElementFilter(bpy.types.Operator, tool.Ifc.Operator): class EditElementFilter(bpy.types.Operator, tool.Ifc.Operator): bl_idname = "bim.edit_element_filter" bl_label = "Edit Element Filter" + bl_description = "Saves the filter" bl_options = {"REGISTER", "UNDO"} filter_mode: bpy.props.StringProperty()