From 25fff3fdd01dfd167ae84d6b0c86d12653ea0bc6 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Fri, 3 May 2024 17:01:54 +1000 Subject: [PATCH] Consolidate duplicate operators "Convert to Blender file" and "Purge IFC Links" --- .../blenderbim/bim/module/debug/__init__.py | 1 - .../blenderbim/bim/module/debug/operator.py | 29 ++++--------------- .../blenderbim/bim/module/debug/ui.py | 3 -- 3 files changed, 5 insertions(+), 28 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/module/debug/__init__.py b/src/blenderbim/blenderbim/bim/module/debug/__init__.py index 271950ea61..8790917a4a 100644 --- a/src/blenderbim/blenderbim/bim/module/debug/__init__.py +++ b/src/blenderbim/blenderbim/bim/module/debug/__init__.py @@ -35,7 +35,6 @@ classes = ( operator.PrintUnusedElementStats, operator.ProfileImportIFC, operator.PurgeHdf5Cache, - operator.PurgeIfcLinks, operator.PurgeUnusedElementsByClass, operator.RewindInspector, operator.SelectExpressFile, diff --git a/src/blenderbim/blenderbim/bim/module/debug/operator.py b/src/blenderbim/blenderbim/bim/module/debug/operator.py index c97791b6ca..b6605d9712 100644 --- a/src/blenderbim/blenderbim/bim/module/debug/operator.py +++ b/src/blenderbim/blenderbim/bim/module/debug/operator.py @@ -104,10 +104,11 @@ class PrintIfcFile(bpy.types.Operator): return {"FINISHED"} -class PurgeIfcLinks(bpy.types.Operator): - bl_idname = "bim.purge_ifc_links" - bl_label = "Purge IFC Links" - bl_description = "Purge all definitions and references from the file.\nWarning : Cannot be undone." +class ConvertToBlender(bpy.types.Operator): + bl_idname = "bim.convert_to_blender" + bl_label = "Convert To Blender File" + bl_description = "Removes all IFC data and revert to basic Blender objects.\nWarning : Cannot be undone." + bl_options = {"REGISTER", "UNDO"} def execute(self, context): for obj in bpy.data.objects: @@ -124,26 +125,6 @@ class PurgeIfcLinks(bpy.types.Operator): return {"FINISHED"} -class ConvertToBlender(bpy.types.Operator): - bl_idname = "bim.convert_to_blender" - bl_label = "Convert To Blender File" - bl_description = "Removes all IFC data, and converts the file to a simple Blender file." - bl_options = {"REGISTER", "UNDO"} - - def execute(self, context): - for o in bpy.data.objects: - if o.type in {"MESH", "EMPTY"}: - o.BIMObjectProperties.ifc_definition_id = 0 - if o.data: - o.data.BIMMeshProperties.ifc_definition_id = 0 - for m in bpy.data.materials: - m.BIMMaterialProperties.ifc_style_id = False - bpy.context.scene.BIMProperties.ifc_file = "" - IfcStore.purge() - blenderbim.bim.handler.refresh_ui_data() - return {"FINISHED"} - - class ValidateIfcFile(bpy.types.Operator): bl_idname = "bim.validate_ifc_file" bl_label = "Validate IFC File" diff --git a/src/blenderbim/blenderbim/bim/module/debug/ui.py b/src/blenderbim/blenderbim/bim/module/debug/ui.py index 2fd503cf6f..ec296b47d6 100644 --- a/src/blenderbim/blenderbim/bim/module/debug/ui.py +++ b/src/blenderbim/blenderbim/bim/module/debug/ui.py @@ -60,9 +60,6 @@ class BIM_PT_debug(Panel): row = layout.row() row.operator("bim.purge_hdf5_cache") - row = layout.row() - row.operator("bim.purge_ifc_links") - row = layout.row() row.operator("bim.update_representation", text="Manually Save Representation")