Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions manim/mobject/opengl/opengl_vectorized_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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):
Expand All @@ -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,
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
13 changes: 9 additions & 4 deletions manim/mobject/svg/svg_mobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,18 @@
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

Check warning

Code scanning / CodeQL

Overwriting attribute in super-class or sub-class Warning

Assignment overwrites attribute stroke_width, which was previously defined in superclass
VMobject
.
else:
self.stroke_width = np.array([[stroke_width]]) # type: ignore[assignment]

Check warning

Code scanning / CodeQL

Overwriting attribute in super-class or sub-class Warning

Assignment overwrites attribute stroke_width, which was previously defined in superclass
VMobject
.

if svg_default is None:
svg_default = {
"color": None,
"opacity": None,
"fill_color": None,
"fill_opacity": None,
"stroke_width": 0,
"stroke_width": None,
"stroke_color": None,
"stroke_opacity": None,
}
Expand Down Expand Up @@ -327,13 +328,17 @@
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,
stroke_opacity=shape.stroke.opacity,
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:
Expand Down
Loading