mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 22:11:36 +00:00
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:
@@ -332,10 +332,12 @@ class IfcStore:
|
|||||||
IfcStore.id_map[data["id"]] = obj
|
IfcStore.id_map[data["id"]] = obj
|
||||||
if "guid" in data:
|
if "guid" in data:
|
||||||
IfcStore.guid_map[data["guid"]] = obj
|
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)
|
blenderbim.bim.handler.subscribe_to(obj, "name", blenderbim.bim.handler.name_callback)
|
||||||
if isinstance(obj, bpy.types.Material):
|
if isinstance(obj, bpy.types.Material):
|
||||||
blenderbim.bim.handler.subscribe_to(obj, "diffuse_color", blenderbim.bim.handler.color_callback)
|
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 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.
|
# 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):
|
class RemoveType(bpy.types.Operator, tool.Ifc.Operator):
|
||||||
bl_idname = "bim.remove_type"
|
bl_idname = "bim.remove_type"
|
||||||
bl_label = "Remove Type"
|
bl_label = "Remove Type"
|
||||||
bl_options = {"REGISTER"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
element: bpy.props.IntProperty()
|
element: bpy.props.IntProperty()
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
@@ -474,7 +474,7 @@ class RenameType(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
class DuplicateType(bpy.types.Operator, tool.Ifc.Operator):
|
class DuplicateType(bpy.types.Operator, tool.Ifc.Operator):
|
||||||
bl_idname = "bim.duplicate_type"
|
bl_idname = "bim.duplicate_type"
|
||||||
bl_label = "Duplicate Type"
|
bl_label = "Duplicate Type"
|
||||||
bl_options = {"REGISTER"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
element: bpy.props.IntProperty()
|
element: bpy.props.IntProperty()
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
@@ -500,7 +500,7 @@ class DuplicateType(bpy.types.Operator, tool.Ifc.Operator):
|
|||||||
class PurgeUnusedTypes(bpy.types.Operator, tool.Ifc.Operator):
|
class PurgeUnusedTypes(bpy.types.Operator, tool.Ifc.Operator):
|
||||||
bl_idname = "bim.purge_unused_types"
|
bl_idname = "bim.purge_unused_types"
|
||||||
bl_label = "Purge Unused Types"
|
bl_label = "Purge Unused Types"
|
||||||
bl_options = {"REGISTER"}
|
bl_options = {"REGISTER", "UNDO"}
|
||||||
|
|
||||||
def _execute(self, context):
|
def _execute(self, context):
|
||||||
core.purge_unused_types(tool.Ifc, tool.Type)
|
core.purge_unused_types(tool.Ifc, tool.Type)
|
||||||
|
|||||||
Reference in New Issue
Block a user