A community-maintained Python framework for creating mathematical animations.
Opengl compatibility for :class:`~.VDict`, :class:`~.Axes.get_line_graph` and :class:`~.FocusOn`. (#1833)
Laith Bahodifb751444a561
diff --git a/manim/animation/indication.py b/manim/animation/indication.pyindex 8cd18f0f6..79a7a1bd5 100644--- a/manim/animation/indication.py+++ b/manim/animation/indication.py@@ -104,7 +104,7 @@ class FocusOn(Transform):remover = True# Initialize with blank mobject, while create_target# and create_starting_mobject handle the meat- super().__init__(VMobject(), run_time=run_time, remover=remover, **kwargs)+ super().__init__(VGroup(), run_time=run_time, remover=remover, **kwargs)def create_target(self) -> "Dot":little_dot = Dot(radius=0)diff --git a/manim/mobject/coordinate_systems.py b/manim/mobject/coordinate_systems.pyindex 406baa4cf..6db45fb3d 100644--- a/manim/mobject/coordinate_systems.py+++ b/manim/mobject/coordinate_systems.py@@ -1242,7 +1242,8 @@ class Axes(VGroup, CoordinateSystem, metaclass=ConvertToOpenGL):z_values = np.zeros(x_values.shape)line_graph = VDict()- graph = VMobject(color=line_color, **kwargs)+ graph = VGroup(color=line_color, **kwargs)+vertices = [self.coords_to_point(x, y, z)for x, y, z in zip(x_values, y_values, z_values)diff --git a/manim/mobject/types/image_mobject.py b/manim/mobject/types/image_mobject.pyindex 28bdfbca3..2afa1630f 100644--- a/manim/mobject/types/image_mobject.py+++ b/manim/mobject/types/image_mobject.py@@ -40,7 +40,7 @@ class AbstractImageMobject(Mobject):self.pixel_array_dtype = pixel_array_dtypeself.scale_to_resolution = scale_to_resolutionself.set_resampling_algorithm(resampling_algorithm)- Mobject.__init__(self, **kwargs)+ super().__init__(**kwargs)def get_pixel_array(self):raise NotImplementedError()@@ -284,7 +284,7 @@ class ImageMobjectFromCamera(AbstractImageMobject):}self.default_display_frame_config = default_display_frame_configself.pixel_array = self.camera.pixel_array- AbstractImageMobject.__init__(self, scale_to_resolution=False, **kwargs)+ super().__init__(scale_to_resolution=False, **kwargs)# TODO: Get rid of this.def get_pixel_array(self):diff --git a/manim/mobject/types/vectorized_mobject.py b/manim/mobject/types/vectorized_mobject.pyindex 69742d198..33dd4512f 100644--- a/manim/mobject/types/vectorized_mobject.py+++ b/manim/mobject/types/vectorized_mobject.py@@ -1675,7 +1675,7 @@ class VGroup(VMobject, metaclass=ConvertToOpenGL):self.submobjects[key] = value-class VDict(VMobject):+class VDict(VMobject, metaclass=ConvertToOpenGL):"""A VGroup-like class, also offering submobject access bykey, like a python dict@@ -1774,7 +1774,7 @@ class VDict(VMobject):"""def __init__(self, mapping_or_iterable={}, show_keys=False, **kwargs):- VMobject.__init__(self, **kwargs)+ super().__init__(**kwargs)self.show_keys = show_keysself.submob_dict = {}self.add(mapping_or_iterable)@@ -1987,7 +1987,7 @@ class VDict(VMobject):self.add_key_value_pair('s', square_obj)"""- if not isinstance(value, VMobject):+ if not isinstance(value, (VMobject, OpenGLVMobject)):raise TypeError("All submobjects must be of type VMobject")mob = valueif self.show_keys: