Fix bug where undoing broke the IFC link for child objects

This commit is contained in:
Dion Moult
2021-08-06 10:26:18 +10:00
parent 0ee881fb32
commit 47440edb8b
+4 -1
View File
@@ -79,15 +79,18 @@ class IfcStore:
in a regular Python list, there is the likely probability that the object in a regular Python list, there is the likely probability that the object
will be invalidated when undo or redo occurs. Object invalidation seems to will be invalidated when undo or redo occurs. Object invalidation seems to
only occur for selected objects either pre/post undo/redo event, including only occur for selected objects either pre/post undo/redo event, including
selected objects for consecutive undo/redos. selected objects for consecutive undo/redos, and all children.
So if I first select o1, then o2, then o3, then press undo, o3 will be So if I first select o1, then o2, then o3, then press undo, o3 will be
invalidated. If instead I press undo twice, o3 and o2 will be invalidated. invalidated. If instead I press undo twice, o3 and o2 will be invalidated.
""" """
if bpy.context.active_object: if bpy.context.active_object:
objects = set([o.name for o in bpy.context.selected_objects + [bpy.context.active_object]]) objects = set([o.name for o in bpy.context.selected_objects + [bpy.context.active_object]])
objects.update([o.name for o in bpy.context.active_object.children])
else: else:
objects = set([o.name for o in bpy.context.selected_objects]) objects = set([o.name for o in bpy.context.selected_objects])
for obj in bpy.context.selected_objects:
objects.update([o.name for o in obj.children])
IfcStore.undo_redo_stack_objects |= objects IfcStore.undo_redo_stack_objects |= objects
@staticmethod @staticmethod