#2224 You can now bulk check/uncheck filter categories on import

This commit is contained in:
Dion Moult
2022-06-08 09:09:35 +10:00
parent 1ec0e1ce19
commit 2ab808a216
3 changed files with 34 additions and 17 deletions
@@ -20,28 +20,29 @@ import bpy
from . import ui, prop, operator
classes = (
operator.CreateProject,
operator.LoadProject,
operator.UnloadProject,
operator.LoadProjectElements,
operator.LinkIfc,
operator.UnlinkIfc,
operator.UnloadLink,
operator.LoadLink,
operator.ToggleLinkVisibility,
operator.SelectLibraryFile,
operator.ChangeLibraryElement,
operator.RefreshLibrary,
operator.RewindLibrary,
operator.AssignLibraryDeclaration,
operator.UnassignLibraryDeclaration,
operator.SaveLibraryFile,
operator.AppendLibraryElement,
operator.EnableEditingHeader,
operator.AssignLibraryDeclaration,
operator.ChangeLibraryElement,
operator.CreateProject,
operator.DisableEditingHeader,
operator.EditHeader,
operator.EnableEditingHeader,
operator.ExportIFC,
operator.ImportIFC,
operator.LinkIfc,
operator.LoadLink,
operator.LoadProject,
operator.LoadProjectElements,
operator.RefreshLibrary,
operator.RewindLibrary,
operator.SaveLibraryFile,
operator.SelectLibraryFile,
operator.ToggleFilterCategories,
operator.ToggleLinkVisibility,
operator.UnassignLibraryDeclaration,
operator.UnlinkIfc,
operator.UnloadLink,
operator.UnloadProject,
prop.LibraryElement,
prop.FilterCategory,
prop.Link,
@@ -604,6 +604,18 @@ class LoadProjectElements(bpy.types.Operator):
return set(self.file.by_type("IfcElement")) - set(selector.parse(self.file, self.props.filter_query))
class ToggleFilterCategories(bpy.types.Operator):
bl_idname = "bim.toggle_filter_categories"
bl_label = "Toggle Filter Categories"
bl_options = {"REGISTER", "UNDO"}
should_select: bpy.props.BoolProperty(name="Should Select", default=True)
def execute(self, context):
for filter_category in context.scene.BIMProjectProperties.filter_categories:
filter_category.is_selected = self.should_select
return {"FINISHED"}
class LinkIfc(bpy.types.Operator):
bl_idname = "bim.link_ifc"
bl_label = "Link IFC"
@@ -53,6 +53,10 @@ class BIM_PT_project(Panel):
row = self.layout.row()
row.prop(pprops, "filter_mode")
if pprops.filter_mode in ["DECOMPOSITION", "IFC_CLASS"]:
row = self.layout.row(align=True)
row.alignment = "RIGHT"
row.operator("bim.toggle_filter_categories", text="", icon="CHECKBOX_HLT").should_select = True
row.operator("bim.toggle_filter_categories", text="", icon="CHECKBOX_DEHLT").should_select = False
self.layout.template_list(
"BIM_UL_filter_categories",
"",