Added selection checkmarks to Sheets, and operator to select all/none, to do batch ops on sheets

This commit is contained in:
Stephen Boddy
2024-11-01 23:11:53 +00:00
parent 4cfc0bd9f3
commit 83d2f01ce9
4 changed files with 25 additions and 0 deletions
@@ -86,6 +86,7 @@ classes = (
operator.SaveDrawingStyle,
operator.SaveDrawingStylesData,
operator.SelectAllDrawings,
operator.SelectAllSheets,
operator.SelectAssignedProduct,
operator.SelectDocIfcFile,
operator.OpenDocumentationWebUi,
@@ -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"
@@ -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)
@@ -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")