A community-maintained Python framework for creating mathematical animations.
OpenGL: changed ``submobjects`` to be a property (#1926)
Ryan McCauley632a11f4d2b7
diff --git a/manim/mobject/opengl_mobject.py b/manim/mobject/opengl_mobject.pyindex 1e61549e2..eb42e915f 100644--- a/manim/mobject/opengl_mobject.py+++ b/manim/mobject/opengl_mobject.py@@ -101,7 +101,7 @@ class OpenGLMobject:# Event listenerself.listen_to_events = listen_to_events- self.submobjects = []+ self._submobjects = []self.parents = []self.parent = Noneself.family = [self]@@ -471,6 +471,12 @@ class OpenGLMobject:self.assemble_family()return self+ @deprecated(+ since="v0.12.0",+ until="v0.13.0",+ replacement="self.submobjects",+ message="Switching to using properties for submobjects",+ )def set_submobjects(self, submobject_list):self.remove(*self.submobjects)self.add(*submobject_list)@@ -1904,6 +1910,15 @@ class OpenGLMobject:def get_shader_vert_indices(self):return self.shader_indices+ @property+ def submobjects(self):+ return self._submobjects++ @submobjects.setter+ def submobjects(self, submobject_list):+ self.remove(*self.submobjects)+ self.add(*submobject_list)+# Event Handlers"""Event handling follows the Event Bubbling model of DOM in javascript.diff --git a/manim/mobject/svg/text_mobject.py b/manim/mobject/svg/text_mobject.pyindex a084ebadb..373cf6451 100644--- a/manim/mobject/svg/text_mobject.py+++ b/manim/mobject/svg/text_mobject.py@@ -482,10 +482,7 @@ class Text(SVGMobject):)self.text = textif self.disable_ligatures:- if config.renderer == "opengl":- self.set_submobjects(self.gen_chars())- else:- self.submobjects = [*self.gen_chars()]+ self.submobjects = [*self.gen_chars()]self.chars = self.get_group_class()(*self.submobjects)self.text = text_without_tabs.replace(" ", "").replace("\n", "")if config.renderer == "opengl":