From be52b795df69c4d34ea018a94437111c80588e63 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Mon, 13 Aug 2018 14:13:30 -0700 Subject: [PATCH] Make sure scene doesn't re-add animated submobjects that are already part of the scene via some other mobject --- scene/scene.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scene/scene.py b/scene/scene.py index 1f9f072f..3210a6ea 100644 --- a/scene/scene.py +++ b/scene/scene.py @@ -216,6 +216,9 @@ class Scene(Container): return num_families == 1 return list(filter(is_top_level, mobjects)) + def get_mobject_family_members(self): + return self.camera.extract_mobject_family_members(self.mobjects) + def separate_mobjects_and_continual_animations(self, mobjects_or_continual_animations): mobjects = [] continual_animations = [] @@ -461,7 +464,7 @@ class Scene(Container): animation.update_config(**kwargs) # Anything animated that's not already in the # scene gets added to the scene - if animation.mobject not in self.mobjects: + if animation.mobject not in self.get_mobject_family_members(): self.add(animation.mobject) moving_mobjects = self.get_moving_mobjects(*animations)