diff --git a/manimlib/mobject/svg/svg_mobject.py b/manimlib/mobject/svg/svg_mobject.py index abcd7d91..2de59192 100644 --- a/manimlib/mobject/svg/svg_mobject.py +++ b/manimlib/mobject/svg/svg_mobject.py @@ -329,7 +329,7 @@ class VMobjectFromSVGPathstring(VMobject): def __init__(self, path_string, **kwargs): self.path_string = path_string - VMobject.__init__(self, **kwargs) + super().__init__(**kwargs) def init_points(self): # TODO, move this caching operation @@ -355,10 +355,10 @@ class VMobjectFromSVGPathstring(VMobject): self.subdivide_sharp_curves() # SVG treats y-coordinate differently self.stretch(-1, 1, about_point=ORIGIN) + # Get rid of any null curves + self.points = self.get_points_without_null_curves() # Save to a file for future use np.save(filepath, self.points) - # Faster rendering - self.lock_triangulation() def get_commands_and_coord_strings(self): all_commands = list(self.get_command_to_function_map().keys()) diff --git a/manimlib/mobject/types/vectorized_mobject.py b/manimlib/mobject/types/vectorized_mobject.py index a3992053..302835fa 100644 --- a/manimlib/mobject/types/vectorized_mobject.py +++ b/manimlib/mobject/types/vectorized_mobject.py @@ -608,8 +608,6 @@ class VMobject(Mobject): def get_points_without_null_curves(self, atol=1e-9): nppc = self.n_points_per_curve - if len(self.points) <= nppc + 1: - return self.points distinct_curves = reduce(op.or_, [ (abs(self.points[i::nppc] - self.points[0::nppc]) > atol).any(1) for i in range(1, nppc) @@ -912,7 +910,7 @@ class VMobject(Mobject): if len(stroke_width) > 1: stroke_width = self.stretched_style_array_matching_points(stroke_width) - points = self.get_points_without_null_curves() + points = self.points nppc = self.n_points_per_curve data = self.get_blank_shader_data_array(len(points), "stroke_data")