Fix undo bugs in the type module where some operators were not part of the undo system for some reason.

This commit is contained in:
Dion Moult
2023-07-15 00:00:10 +10:00
parent 2034fa203b
commit a2e7cb8158
2 changed files with 6 additions and 4 deletions
+3 -1
View File
@@ -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.
@@ -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)