diff --git a/src/blenderbim/blenderbim/bim/module/tester/operator.py b/src/blenderbim/blenderbim/bim/module/tester/operator.py index 8560462eb2..dcc1165068 100644 --- a/src/blenderbim/blenderbim/bim/module/tester/operator.py +++ b/src/blenderbim/blenderbim/bim/module/tester/operator.py @@ -27,6 +27,7 @@ import ifctester.reporter import ifcopenshell import blenderbim.tool as tool import blenderbim.bim.handler +from blenderbim.bim.operator import MultipleFileSelector from pathlib import Path @@ -92,38 +93,32 @@ class ExecuteIfcTester(bpy.types.Operator, tool.Ifc.Operator): return {"FINISHED"} -class SelectSpecs(bpy.types.Operator): +class SelectSpecs(MultipleFileSelector): bl_idname = "bim.select_specs" bl_label = "Select IDS" - bl_options = {"REGISTER", "UNDO"} filename_ext = ".ids" filter_glob: bpy.props.StringProperty(default="*.ids;*.xml", options={"HIDDEN"}) filepath: bpy.props.StringProperty(subtype="FILE_PATH") def execute(self, context): - context.scene.IfcTesterProperties.specs = self.filepath + props = context.scene.IfcTesterProperties + + self.update_props(props, "specs", props.specs_files) return {"FINISHED"} - def invoke(self, context, event): - context.window_manager.fileselect_add(self) - return {"RUNNING_MODAL"} -class SelectIfcTesterIfcFile(bpy.types.Operator): +class SelectIfcTesterIfcFile(MultipleFileSelector): bl_idname = "bim.select_ifctester_ifc_file" bl_label = "Select IfcTester IFC File" - bl_options = {"REGISTER", "UNDO"} filename_ext = ".ifc" filter_glob: bpy.props.StringProperty(default="*.ifc;*.ifczip;*.ifcxml", options={"HIDDEN"}) - filepath: bpy.props.StringProperty(subtype="FILE_PATH") def execute(self, context): - context.scene.IfcTesterProperties.ifc_file = self.filepath - return {"FINISHED"} + props = context.scene.IfcTesterProperties - def invoke(self, context, event): - context.window_manager.fileselect_add(self) - return {"RUNNING_MODAL"} + self.update_props(props, "ifc_file", props.ifc_files) + return {"FINISHED"} class SelectRequirement(bpy.types.Operator): diff --git a/src/blenderbim/blenderbim/bim/module/tester/prop.py b/src/blenderbim/blenderbim/bim/module/tester/prop.py index 96e5a939f9..9e4dbb88e1 100644 --- a/src/blenderbim/blenderbim/bim/module/tester/prop.py +++ b/src/blenderbim/blenderbim/bim/module/tester/prop.py @@ -49,7 +49,9 @@ class FailedEntities(PropertyGroup): class IfcTesterProperties(PropertyGroup): specs: StringProperty(default="", name="IDS File") + specs_files: CollectionProperty(name="IDS Files", type=StrProperty) ifc_file: StringProperty(default="", name="IFC File") + ifc_files: CollectionProperty(name="IFC Files", type=StrProperty) should_load_from_memory: BoolProperty(default=False, name="Load from Memory") generate_html_report: BoolProperty(default=False, name="Generate HTML report", options=set()) generate_ods_report: BoolProperty(default=False, name="Generate ODS report", options=set()) diff --git a/src/blenderbim/blenderbim/bim/module/tester/ui.py b/src/blenderbim/blenderbim/bim/module/tester/ui.py index b4ae0bcdad..e864580691 100644 --- a/src/blenderbim/blenderbim/bim/module/tester/ui.py +++ b/src/blenderbim/blenderbim/bim/module/tester/ui.py @@ -50,11 +50,18 @@ class BIM_PT_tester(Panel): if not tool.Ifc.get() or not props.should_load_from_memory: row = self.layout.row(align=True) - row.prop(props, "ifc_file") + if len(props.ifc_files) > 1: + row.label(text=f"{len(props.ifc_files)} Files Selected") + else: + row.prop(props, "ifc_file") + row.operator("bim.select_ifctester_ifc_file", icon="FILE_FOLDER", text="") row = self.layout.row(align=True) - row.prop(props, "specs") + if len(props.specs_files) > 1: + row.label(text=f"{len(props.specs_files)} Files Selected") + else: + row.prop(props, "specs") row.operator("bim.select_specs", icon="FILE_FOLDER", text="") row = self.layout.row()