From ed1cbe32ff14fa75df73b1408924d7f6e1b2090b Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Thu, 27 Feb 2020 17:19:15 +0000 Subject: [PATCH] Don't copy a mobject's parents --- manimlib/mobject/mobject.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/manimlib/mobject/mobject.py b/manimlib/mobject/mobject.py index 9774616b..2fe051dc 100644 --- a/manimlib/mobject/mobject.py +++ b/manimlib/mobject/mobject.py @@ -189,9 +189,12 @@ class Mobject(Container): # remove this redundancy everywhere # return self.deepcopy() + parents = self.parents + self.parents = [] copy_mobject = copy.copy(self) + self.parents = parents + copy_mobject.points = np.array(self.points) - copy_mobject.parents = [] copy_mobject.submobjects = [] copy_mobject.add(*[sm.copy() for sm in self.submobjects]) copy_mobject.updaters = list(self.updaters) @@ -206,7 +209,10 @@ class Mobject(Container): return copy_mobject def deepcopy(self): + parents = self.parents + self.parents = [] return copy.deepcopy(self) + self.parents = parents def generate_target(self, use_deepcopy=False): self.target = None # Prevent exponential explosion