mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Don't use @stash_mobject_pointers on copy, be more explicit
This commit is contained in:
parent
bf2a609246
commit
1bd6a77151
1 changed files with 7 additions and 4 deletions
|
@ -591,19 +591,22 @@ class Mobject(object):
|
||||||
result._shaders_initialized = False
|
result._shaders_initialized = False
|
||||||
result._data_has_changed = True
|
result._data_has_changed = True
|
||||||
|
|
||||||
@stash_mobject_pointers
|
|
||||||
def copy(self, deep: bool = False):
|
def copy(self, deep: bool = False):
|
||||||
if deep:
|
if deep:
|
||||||
return self.deepcopy()
|
return self.deepcopy()
|
||||||
|
|
||||||
result = copy.copy(self)
|
result = copy.copy(self)
|
||||||
|
|
||||||
# The line above is only a shallow copy, so the internal
|
result.parents = []
|
||||||
# data which are numpyu arrays or other mobjects still
|
result.target = None
|
||||||
|
result.save_state = None
|
||||||
|
|
||||||
|
# copy.copy is only a shallow copy, so the internal
|
||||||
|
# data which are numpy arrays or other mobjects still
|
||||||
# need to be further copied.
|
# need to be further copied.
|
||||||
result.data = self.data.copy()
|
result.data = self.data.copy()
|
||||||
result.uniforms = {
|
result.uniforms = {
|
||||||
key: np.array(value)
|
key: value.copy() if isinstance(value, np.ndarray) else value
|
||||||
for key, value in self.uniforms.items()
|
for key, value in self.uniforms.items()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue