From 6706ad9bd58795f7e096800f7a9cbd1677b9fd6f Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Wed, 7 Jul 2021 10:40:07 +1000 Subject: [PATCH] Implement undo for augin, bimtester, clash, cobie, and covetool operators. See #1475. --- .../blenderbim/bim/module/augin/operator.py | 3 +++ .../blenderbim/bim/module/bimtester/operator.py | 4 ++++ .../blenderbim/bim/module/clash/operator.py | 14 ++++++++++++++ .../blenderbim/bim/module/cobie/operator.py | 2 ++ .../blenderbim/bim/module/covetool/operator.py | 1 + 5 files changed, 24 insertions(+) diff --git a/src/blenderbim/blenderbim/bim/module/augin/operator.py b/src/blenderbim/blenderbim/bim/module/augin/operator.py index 32d6b390e7..28790024fa 100644 --- a/src/blenderbim/blenderbim/bim/module/augin/operator.py +++ b/src/blenderbim/blenderbim/bim/module/augin/operator.py @@ -13,6 +13,7 @@ import addon_utils class AuginLogin(bpy.types.Operator): bl_idname = "bim.augin_login" bl_label = "Login to Augin" + bl_options = {"REGISTER", "UNDO"} def execute(self, context): props = bpy.context.scene.AuginProperties @@ -32,6 +33,7 @@ class AuginLogin(bpy.types.Operator): class AuginReset(bpy.types.Operator): bl_idname = "bim.augin_reset" bl_label = "Upload Another Project" + bl_options = {"REGISTER", "UNDO"} def execute(self, context): props = bpy.context.scene.AuginProperties @@ -42,6 +44,7 @@ class AuginReset(bpy.types.Operator): class AuginCreateNewModel(bpy.types.Operator): bl_idname = "bim.augin_create_new_model" bl_label = "Create New Augin Model" + bl_options = {"REGISTER", "UNDO"} def execute(self, context): import boto3 diff --git a/src/blenderbim/blenderbim/bim/module/bimtester/operator.py b/src/blenderbim/blenderbim/bim/module/bimtester/operator.py index cc3e941402..5e02e59e40 100644 --- a/src/blenderbim/blenderbim/bim/module/bimtester/operator.py +++ b/src/blenderbim/blenderbim/bim/module/bimtester/operator.py @@ -65,6 +65,7 @@ class BIMTesterPurge(bpy.types.Operator): class SelectFeature(bpy.types.Operator): bl_idname = "bim.select_feature" bl_label = "Select Feature / IDS" + bl_options = {"REGISTER", "UNDO"} filename_ext = ".feature" filter_glob: bpy.props.StringProperty(default="*.feature;*.xml", options={"HIDDEN"}) filepath: bpy.props.StringProperty(subtype="FILE_PATH") @@ -81,6 +82,7 @@ class SelectFeature(bpy.types.Operator): class SelectSteps(bpy.types.Operator): bl_idname = "bim.select_steps" bl_label = "Select Steps" + bl_options = {"REGISTER", "UNDO"} filename_ext = ".py" filter_glob: bpy.props.StringProperty(default="*.py", options={"HIDDEN"}) filepath: bpy.props.StringProperty(subtype="FILE_PATH") @@ -97,6 +99,7 @@ class SelectSteps(bpy.types.Operator): class SelectBIMTesterIfcFile(bpy.types.Operator): bl_idname = "bim.select_bimtester_ifc_file" bl_label = "Select BIMTester 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") @@ -167,6 +170,7 @@ class RejectClass(bpy.types.Operator): class SelectAudited(bpy.types.Operator): bl_idname = "bim.select_audited" bl_label = "Select Audited" + bl_options = {"REGISTER", "UNDO"} def execute(self, context): audited_global_ids = [] diff --git a/src/blenderbim/blenderbim/bim/module/clash/operator.py b/src/blenderbim/blenderbim/bim/module/clash/operator.py index b6824ace7f..9212d2ae77 100644 --- a/src/blenderbim/blenderbim/bim/module/clash/operator.py +++ b/src/blenderbim/blenderbim/bim/module/clash/operator.py @@ -42,6 +42,7 @@ class ExportClashSets(bpy.types.Operator): class ImportClashSets(bpy.types.Operator): bl_idname = "bim.import_clash_sets" bl_label = "Import Clash Sets" + bl_options = {"REGISTER", "UNDO"} filename_ext = ".json" filepath: bpy.props.StringProperty(subtype="FILE_PATH") @@ -77,6 +78,7 @@ class ImportClashSets(bpy.types.Operator): class AddClashSet(bpy.types.Operator): bl_idname = "bim.add_clash_set" bl_label = "Add Clash Set" + bl_options = {"REGISTER", "UNDO"} def execute(self, context): new = bpy.context.scene.BIMClashProperties.clash_sets.add() @@ -88,6 +90,7 @@ class AddClashSet(bpy.types.Operator): class RemoveClashSet(bpy.types.Operator): bl_idname = "bim.remove_clash_set" bl_label = "Remove Clash Set" + bl_options = {"REGISTER", "UNDO"} index: bpy.props.IntProperty() def execute(self, context): @@ -98,6 +101,7 @@ class RemoveClashSet(bpy.types.Operator): class AddClashSource(bpy.types.Operator): bl_idname = "bim.add_clash_source" bl_label = "Add Clash Source" + bl_options = {"REGISTER", "UNDO"} group: bpy.props.StringProperty() def execute(self, context): @@ -109,6 +113,7 @@ class AddClashSource(bpy.types.Operator): class RemoveClashSource(bpy.types.Operator): bl_idname = "bim.remove_clash_source" bl_label = "Remove Clash Source" + bl_options = {"REGISTER", "UNDO"} index: bpy.props.IntProperty() group: bpy.props.StringProperty() @@ -121,6 +126,7 @@ class RemoveClashSource(bpy.types.Operator): class SelectClashSource(bpy.types.Operator): bl_idname = "bim.select_clash_source" bl_label = "Select Clash Source" + bl_options = {"REGISTER", "UNDO"} filepath: bpy.props.StringProperty(subtype="FILE_PATH") index: bpy.props.IntProperty() group: bpy.props.StringProperty() @@ -138,6 +144,7 @@ class SelectClashSource(bpy.types.Operator): class SelectClashResults(bpy.types.Operator): bl_idname = "bim.select_clash_results" bl_label = "Select Clash Results" + bl_options = {"REGISTER", "UNDO"} filepath: bpy.props.StringProperty(subtype="FILE_PATH") def execute(self, context): @@ -152,6 +159,7 @@ class SelectClashResults(bpy.types.Operator): class SelectSmartGroupedClashesPath(bpy.types.Operator): bl_idname = "bim.select_smart_grouped_clashes_path" bl_label = "Select Smart-Grouped Clashes Path" + bl_options = {"REGISTER", "UNDO"} filepath: bpy.props.StringProperty(subtype="FILE_PATH") def execute(self, context): @@ -233,6 +241,7 @@ class ExecuteIfcClash(bpy.types.Operator): class SelectIfcClashResults(bpy.types.Operator): bl_idname = "bim.select_ifc_clash_results" bl_label = "Select IFC Clash Results" + bl_options = {"REGISTER", "UNDO"} filename_ext = ".json" filepath: bpy.props.StringProperty(subtype="FILE_PATH") @@ -270,6 +279,7 @@ class SelectIfcClashResults(bpy.types.Operator): class SmartClashGroup(bpy.types.Operator): bl_idname = "bim.smart_clash_group" bl_label = "Smart Group Clashes" + bl_options = {"REGISTER", "UNDO"} filepath: bpy.props.StringProperty(subtype="FILE_PATH") def execute(self, context): @@ -322,6 +332,7 @@ class SmartClashGroup(bpy.types.Operator): class LoadSmartGroupsForActiveClashSet(bpy.types.Operator): bl_idname = "bim.load_smart_groups_for_active_clash_set" bl_label = "Load Smart Groups for Active Clash Set" + bl_options = {"REGISTER", "UNDO"} def execute(self, context): smart_groups_path = bpy.path.ensure_ext(bpy.context.scene.BIMClashProperties.smart_grouped_clashes_path, ".json") @@ -355,6 +366,7 @@ class LoadSmartGroupsForActiveClashSet(bpy.types.Operator): class SelectSmartGroup(bpy.types.Operator): bl_idname = "bim.select_smart_group" bl_label = "Select Smart Group" + bl_options = {"REGISTER", "UNDO"} def execute(self, context): # Select smart group in view @@ -423,6 +435,7 @@ class BlenderClasher: class SetBlenderClashSetA(bpy.types.Operator): bl_idname = "bim.set_blender_clash_set_a" bl_label = "Set Blender Clash Set A" + bl_options = {"REGISTER", "UNDO"} def execute(self, context): while len(bpy.context.scene.BIMClashProperties.blender_clash_set_a) > 0: @@ -436,6 +449,7 @@ class SetBlenderClashSetA(bpy.types.Operator): class SetBlenderClashSetB(bpy.types.Operator): bl_idname = "bim.set_blender_clash_set_b" bl_label = "Set Blender Clash Set B" + bl_options = {"REGISTER", "UNDO"} def execute(self, context): while len(bpy.context.scene.BIMClashProperties.blender_clash_set_b) > 0: diff --git a/src/blenderbim/blenderbim/bim/module/cobie/operator.py b/src/blenderbim/blenderbim/bim/module/cobie/operator.py index 9e12c090be..ccda8add22 100644 --- a/src/blenderbim/blenderbim/bim/module/cobie/operator.py +++ b/src/blenderbim/blenderbim/bim/module/cobie/operator.py @@ -11,6 +11,7 @@ from blenderbim.bim.ifc import IfcStore class SelectCobieIfcFile(bpy.types.Operator): bl_idname = "bim.select_cobie_ifc_file" bl_label = "Select COBie IFC File" + bl_options = {"REGISTER", "UNDO"} filepath: bpy.props.StringProperty(subtype="FILE_PATH") def execute(self, context): @@ -25,6 +26,7 @@ class SelectCobieIfcFile(bpy.types.Operator): class SelectCobieJsonFile(bpy.types.Operator): bl_idname = "bim.select_cobie_json_file" bl_label = "Select COBie JSON File" + bl_options = {"REGISTER", "UNDO"} filepath: bpy.props.StringProperty(subtype="FILE_PATH") def execute(self, context): diff --git a/src/blenderbim/blenderbim/bim/module/covetool/operator.py b/src/blenderbim/blenderbim/bim/module/covetool/operator.py index dcd4ec9dbc..11f0b5efa8 100644 --- a/src/blenderbim/blenderbim/bim/module/covetool/operator.py +++ b/src/blenderbim/blenderbim/bim/module/covetool/operator.py @@ -13,6 +13,7 @@ api = Api() class Login(bpy.types.Operator): bl_idname = "bim.covetool_login" bl_label = "Login to cove.tool" + bl_options = {"REGISTER", "UNDO"} def execute(self, context): token = api.login(bpy.context.scene.CoveToolProperties.username, bpy.context.scene.CoveToolProperties.password)