Implement undo for augin, bimtester, clash, cobie, and covetool operators. See #1475.

This commit is contained in:
Dion Moult
2021-07-07 10:40:07 +10:00
parent fb6c670aa6
commit 6706ad9bd5
5 changed files with 24 additions and 0 deletions
@@ -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
@@ -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 = []
@@ -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:
@@ -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):
@@ -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)