Have Scene.remove look at extended ancestry

This commit is contained in:
Grant Sanderson 2022-04-25 09:55:00 -07:00
parent 40b432a29b
commit 01f0dd30d0

View file

@ -322,9 +322,9 @@ class Scene(object):
the desired behavior is for the scene to then include m2 and m3 (ungrouped).
"""
for mob in mobjects:
# First restructure list so that parents/grandparents/etc. are replaced
# with their children
for ancestor in reversed(mob.get_ancestors()):
# First restructure self.mobjects so that parents/grandparents/etc. are replaced
# with their children, likewise for all ancestors in the extended family.
for ancestor in mob.get_ancestors(extended=True):
self.replace(ancestor, *ancestor.submobjects)
self.mobjects = list_difference_update(self.mobjects, mob.get_family())
return self