mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Don't copy a mobject's parents
This commit is contained in:
parent
6593eab9a0
commit
ed1cbe32ff
1 changed files with 7 additions and 1 deletions
|
@ -189,9 +189,12 @@ class Mobject(Container):
|
||||||
# remove this redundancy everywhere
|
# remove this redundancy everywhere
|
||||||
# return self.deepcopy()
|
# return self.deepcopy()
|
||||||
|
|
||||||
|
parents = self.parents
|
||||||
|
self.parents = []
|
||||||
copy_mobject = copy.copy(self)
|
copy_mobject = copy.copy(self)
|
||||||
|
self.parents = parents
|
||||||
|
|
||||||
copy_mobject.points = np.array(self.points)
|
copy_mobject.points = np.array(self.points)
|
||||||
copy_mobject.parents = []
|
|
||||||
copy_mobject.submobjects = []
|
copy_mobject.submobjects = []
|
||||||
copy_mobject.add(*[sm.copy() for sm in self.submobjects])
|
copy_mobject.add(*[sm.copy() for sm in self.submobjects])
|
||||||
copy_mobject.updaters = list(self.updaters)
|
copy_mobject.updaters = list(self.updaters)
|
||||||
|
@ -206,7 +209,10 @@ class Mobject(Container):
|
||||||
return copy_mobject
|
return copy_mobject
|
||||||
|
|
||||||
def deepcopy(self):
|
def deepcopy(self):
|
||||||
|
parents = self.parents
|
||||||
|
self.parents = []
|
||||||
return copy.deepcopy(self)
|
return copy.deepcopy(self)
|
||||||
|
self.parents = parents
|
||||||
|
|
||||||
def generate_target(self, use_deepcopy=False):
|
def generate_target(self, use_deepcopy=False):
|
||||||
self.target = None # Prevent exponential explosion
|
self.target = None # Prevent exponential explosion
|
||||||
|
|
Loading…
Add table
Reference in a new issue