diff --git a/manim/mobject/opengl/opengl_vectorized_mobject.py b/manim/mobject/opengl/opengl_vectorized_mobject.py index 766c3029a9..d656caf691 100644 --- a/manim/mobject/opengl/opengl_vectorized_mobject.py +++ b/manim/mobject/opengl/opengl_vectorized_mobject.py @@ -124,7 +124,10 @@ def __init__( self.data = {} self.fill_opacity = fill_opacity self.stroke_opacity = stroke_opacity - self.stroke_width = stroke_width + print("OpenGLVMobject") + print(stroke_width) + self.stroke_width = np.array([[stroke_width]]) + print("self.stroke_width:", self.stroke_width) self.draw_stroke_behind_fill = draw_stroke_behind_fill # Indicates that it will not be displayed, but # that it should count in parent mobject's path @@ -199,6 +202,8 @@ def init_colors(self): color=self.fill_color or self.color, opacity=self.fill_opacity, ) + print("init_colors") + print("self.stroke_width:", self.stroke_width) self.set_stroke( color=self.stroke_color or self.color, width=self.stroke_width, @@ -283,7 +288,7 @@ def set_stroke( if width is not None: for mob in self.get_family(recurse): - mob.stroke_width = np.array([[width] for width in tuplify(width)]) + mob.stroke_width = np.array(width) if background is not None: for mob in self.get_family(recurse): @@ -310,8 +315,16 @@ def set_style( if stroke_rgba is not None: self.stroke_rgba = resize_with_interpolation(stroke_rgba, len(fill_rgba)) + print("set_style") + print(self) + print("stroke_width: ", stroke_width) + print("self.stroke_width:", self.stroke_width) self.set_stroke(width=stroke_width) else: + print("set_style") + print(self) + print("stroke_width: ", stroke_width) + print("self.stroke_width:", self.stroke_width) self.set_stroke( color=stroke_color, width=stroke_width, @@ -357,6 +370,8 @@ def set_color(self, color, opacity=None, recurse=True): self.opacity = opacity self.set_fill(color, opacity=opacity, recurse=recurse) + print("set_color") + print(self.stroke_width) self.set_stroke(color, opacity=opacity, recurse=recurse) return self @@ -434,7 +449,11 @@ def get_colors(self): fill_color = property(get_fill_color, set_fill) def has_stroke(self): + print("has_stroke") + print(self) + print("self.stroke_width: ", self.stroke_width) stroke_widths = self.get_stroke_widths() + print("stroke_widths: ", stroke_widths) stroke_opacities = self.get_stroke_opacities() return ( stroke_widths is not None diff --git a/manim/mobject/svg/svg_mobject.py b/manim/mobject/svg/svg_mobject.py index bd494c0211..b96782718d 100644 --- a/manim/mobject/svg/svg_mobject.py +++ b/manim/mobject/svg/svg_mobject.py @@ -126,9 +126,10 @@ def __init__( self.fill_opacity = fill_opacity # type: ignore[assignment] self.stroke_color = stroke_color self.stroke_opacity = stroke_opacity # type: ignore[assignment] - self.stroke_width = stroke_width # type: ignore[assignment] - if self.stroke_width is None: - self.stroke_width = 0 + if stroke_width is None: + self.stroke_width = None + else: + self.stroke_width = np.array([[stroke_width]]) # type: ignore[assignment] if svg_default is None: svg_default = { @@ -136,7 +137,7 @@ def __init__( "opacity": None, "fill_color": None, "fill_opacity": None, - "stroke_width": 0, + "stroke_width": None, "stroke_color": None, "stroke_opacity": None, } @@ -327,6 +328,9 @@ def apply_style_to_mobject(mob: VMobject, shape: se.GraphicObject) -> VMobject: shape The parsed SVG element. """ + print("apply_style_to_mobject") + print("mob") + print("mob.stroke_width:", mob.stroke_width) mob.set_style( stroke_width=shape.stroke_width, stroke_color=shape.stroke.hexrgb, @@ -334,6 +338,7 @@ def apply_style_to_mobject(mob: VMobject, shape: se.GraphicObject) -> VMobject: fill_color=shape.fill.hexrgb, fill_opacity=shape.fill.opacity, ) + print("mob.stroke_width:", mob.stroke_width) return mob def path_to_mobject(self, path: se.Path) -> VMobjectFromSVGPath: