mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Don't deepcopy ShaderWrapper
This commit is contained in:
parent
b9645ad196
commit
0ac9ee1fbf
2 changed files with 12 additions and 2 deletions
|
@ -652,9 +652,13 @@ class Mobject(object):
|
||||||
return self
|
return self
|
||||||
|
|
||||||
def deepcopy(self) -> Self:
|
def deepcopy(self) -> Self:
|
||||||
|
self.parents = []
|
||||||
|
result.target = None
|
||||||
|
result.saved_state = None
|
||||||
|
for submob in self.get_family():
|
||||||
|
submob._shaders_initialized = False
|
||||||
|
submob._data_has_changed = True
|
||||||
result = copy.deepcopy(self)
|
result = copy.deepcopy(self)
|
||||||
result._shaders_initialized = False
|
|
||||||
result._data_has_changed = True
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def copy(self, deep: bool = False) -> Self:
|
def copy(self, deep: bool = False) -> Self:
|
||||||
|
|
|
@ -63,6 +63,12 @@ class ShaderWrapper(object):
|
||||||
self.init_vertex_objects()
|
self.init_vertex_objects()
|
||||||
self.refresh_id()
|
self.refresh_id()
|
||||||
|
|
||||||
|
def __deepcopy__(self, memo):
|
||||||
|
# Don't allow deepcopies, e.g. if the mobject with this ShaderWrapper as an
|
||||||
|
# attribute gets copies. Returning None means the parent object with this ShaderWrapper
|
||||||
|
# as an attribute should smoothly handle this case.
|
||||||
|
return None
|
||||||
|
|
||||||
def init_program_code(self) -> None:
|
def init_program_code(self) -> None:
|
||||||
def get_code(name: str) -> str | None:
|
def get_code(name: str) -> str | None:
|
||||||
return get_shader_code_from_file(
|
return get_shader_code_from_file(
|
||||||
|
|
Loading…
Add table
Reference in a new issue