diff --git a/src/bonsai/bonsai/bim/module/drawing/__init__.py b/src/bonsai/bonsai/bim/module/drawing/__init__.py index a3578ed702..e0c71cd54e 100644 --- a/src/bonsai/bonsai/bim/module/drawing/__init__.py +++ b/src/bonsai/bonsai/bim/module/drawing/__init__.py @@ -86,6 +86,7 @@ classes = ( operator.SaveDrawingStyle, operator.SaveDrawingStylesData, operator.SelectAllDrawings, + operator.SelectAllSheets, operator.SelectAssignedProduct, operator.SelectDocIfcFile, operator.OpenDocumentationWebUi, diff --git a/src/bonsai/bonsai/bim/module/drawing/operator.py b/src/bonsai/bonsai/bim/module/drawing/operator.py index 47632c80a5..5d93917d2f 100644 --- a/src/bonsai/bonsai/bim/module/drawing/operator.py +++ b/src/bonsai/bonsai/bim/module/drawing/operator.py @@ -1468,6 +1468,26 @@ class OpenLayout(bpy.types.Operator, tool.Ifc.Operator): core.open_layout(tool.Drawing, sheet=sheet) +class SelectAllSheets(bpy.types.Operator): + bl_idname = "bim.select_all_sheets" + bl_label = "Select All Sheetss" + view: bpy.props.StringProperty() + bl_description = "Select all sheets in the sheet list.\n\n" + "SHIFT+CLICK to deselect all sheets" + select_all: bpy.props.BoolProperty(name="Open All", default=True, options={"SKIP_SAVE"}) + + def invoke(self, context, event): + # deselect all sheets on shift+click + # make sure to use SKIP_SAVE on property, otherwise it might get stuck + if event.type == "LEFTMOUSE" and event.shift: + self.select_all = False + return self.execute(context) + + def execute(self, context): + for sheet in context.scene.DocProperties.sheets: + if sheet.is_selected != self.select_all: + sheet.is_selected = self.select_all + return {"FINISHED"} + class AddDrawingToSheet(bpy.types.Operator, tool.Ifc.Operator): bl_idname = "bim.add_drawing_to_sheet" bl_label = "Add Drawing To Sheet" diff --git a/src/bonsai/bonsai/bim/module/drawing/prop.py b/src/bonsai/bonsai/bim/module/drawing/prop.py index 4270f9f72d..c176f21043 100644 --- a/src/bonsai/bonsai/bim/module/drawing/prop.py +++ b/src/bonsai/bonsai/bim/module/drawing/prop.py @@ -293,6 +293,7 @@ class Sheet(PropertyGroup): identification: StringProperty(name="Identification") name: StringProperty(name="Name") is_sheet: BoolProperty(name="Is Sheet", default=False) + is_selected: BoolProperty(name="Is Selected", default=True) reference_type: StringProperty(name="Reference Type") is_expanded: BoolProperty(name="Is Expanded", default=False) diff --git a/src/bonsai/bonsai/bim/module/drawing/ui.py b/src/bonsai/bonsai/bim/module/drawing/ui.py index 391fdae6b8..09662aca8b 100644 --- a/src/bonsai/bonsai/bim/module/drawing/ui.py +++ b/src/bonsai/bonsai/bim/module/drawing/ui.py @@ -640,6 +640,9 @@ class BIM_UL_sheets(bpy.types.UIList): item.ifc_definition_id ) + selected_icon = "CHECKBOX_HLT" if item.is_selected else "CHECKBOX_DEHLT" + row.prop(item, "is_selected", text="", icon=selected_icon, emboss=False) + row.label(text=f"{item.identification} - {item.name}") else: row.label(text="", icon="BLANK1")