mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
Undo to clear listeners for linked objects
Typically it's already covered by rebuild_element_maps after undo but just to be consistent with commit_link_element.
This commit is contained in:
@@ -282,17 +282,27 @@ class IfcStore:
|
||||
Operation(rollback=IfcStore.rollback_link_element, commit=IfcStore.commit_link_element, data=data)
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def get_object_by_name(name: str) -> Union[IFC_CONNECTED_TYPE, None]:
|
||||
obj = bpy.data.objects.get(name)
|
||||
if not obj:
|
||||
obj = bpy.data.materials.get(name)
|
||||
return obj
|
||||
|
||||
@staticmethod
|
||||
def rollback_link_element(data: OperationData) -> None:
|
||||
del IfcStore.id_map[data["id"]]
|
||||
if data["guid"]:
|
||||
del IfcStore.guid_map[data["guid"]]
|
||||
obj = IfcStore.get_object_by_name(data["obj"])
|
||||
if obj is None:
|
||||
# obj was just created during this step and didn't existed before.
|
||||
return
|
||||
bpy.msgbus.clear_by_owner(obj)
|
||||
|
||||
@staticmethod
|
||||
def commit_link_element(data: OperationData) -> None:
|
||||
obj = bpy.data.objects.get(data["obj"])
|
||||
if not obj:
|
||||
obj = bpy.data.materials.get(data["obj"])
|
||||
obj = IfcStore.get_object_by_name(data["obj"])
|
||||
IfcStore.id_map[data["id"]] = obj
|
||||
if "guid" in data:
|
||||
IfcStore.guid_map[data["guid"]] = obj
|
||||
|
||||
Reference in New Issue
Block a user