From a2e7cb81584fddb5aa3a194f79bdfa4ad0a79fe7 Mon Sep 17 00:00:00 2001 From: Dion Moult Date: Sat, 15 Jul 2023 00:00:10 +1000 Subject: [PATCH] Fix undo bugs in the type module where some operators were not part of the undo system for some reason. --- src/blenderbim/blenderbim/bim/ifc.py | 4 +++- src/blenderbim/blenderbim/bim/module/type/operator.py | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/blenderbim/blenderbim/bim/ifc.py b/src/blenderbim/blenderbim/bim/ifc.py index 875614e1bd..5533b4fb0c 100644 --- a/src/blenderbim/blenderbim/bim/ifc.py +++ b/src/blenderbim/blenderbim/bim/ifc.py @@ -332,10 +332,12 @@ class IfcStore: IfcStore.id_map[data["id"]] = obj if "guid" in data: IfcStore.guid_map[data["guid"]] = obj - blenderbim.bim.handler.subscribe_to(obj, "mode", blenderbim.bim.handler.mode_callback) blenderbim.bim.handler.subscribe_to(obj, "name", blenderbim.bim.handler.name_callback) if isinstance(obj, bpy.types.Material): blenderbim.bim.handler.subscribe_to(obj, "diffuse_color", blenderbim.bim.handler.color_callback) + elif isinstance(obj, bpy.types.Object): + blenderbim.bim.handler.subscribe_to(obj, "mode", blenderbim.bim.handler.mode_callback) + blenderbim.bim.handler.subscribe_to(obj, "active_material_index", blenderbim.bim.handler.active_material_index_callback) # TODO Listeners are not re-registered. Does this cause nasty problems to debug later on? # TODO We're handling id_map and guid_map, but what about edited_objs? This might cause big problems. diff --git a/src/blenderbim/blenderbim/bim/module/type/operator.py b/src/blenderbim/blenderbim/bim/module/type/operator.py index 921543e5ba..4a0e9e06cd 100644 --- a/src/blenderbim/blenderbim/bim/module/type/operator.py +++ b/src/blenderbim/blenderbim/bim/module/type/operator.py @@ -436,7 +436,7 @@ class AddType(bpy.types.Operator, tool.Ifc.Operator): class RemoveType(bpy.types.Operator, tool.Ifc.Operator): bl_idname = "bim.remove_type" bl_label = "Remove Type" - bl_options = {"REGISTER"} + bl_options = {"REGISTER", "UNDO"} element: bpy.props.IntProperty() def _execute(self, context): @@ -474,7 +474,7 @@ class RenameType(bpy.types.Operator, tool.Ifc.Operator): class DuplicateType(bpy.types.Operator, tool.Ifc.Operator): bl_idname = "bim.duplicate_type" bl_label = "Duplicate Type" - bl_options = {"REGISTER"} + bl_options = {"REGISTER", "UNDO"} element: bpy.props.IntProperty() def _execute(self, context): @@ -500,7 +500,7 @@ class DuplicateType(bpy.types.Operator, tool.Ifc.Operator): class PurgeUnusedTypes(bpy.types.Operator, tool.Ifc.Operator): bl_idname = "bim.purge_unused_types" bl_label = "Purge Unused Types" - bl_options = {"REGISTER"} + bl_options = {"REGISTER", "UNDO"} def _execute(self, context): core.purge_unused_types(tool.Ifc, tool.Type)