Merge branch 'master' of github.com:3b1b/manim into video-work

This commit is contained in:
Grant Sanderson 2022-01-26 08:21:54 -08:00
commit 24f5a50f0b
3 changed files with 35 additions and 30 deletions

View file

@ -38,8 +38,8 @@ class _LabelledTex(SVGMobject):
color_str = "#" + "".join([c * 2 for c in color_str[1:]]) color_str = "#" + "".join([c * 2 for c in color_str[1:]])
return int(color_str[1:], 16) - 1 return int(color_str[1:], 16) - 1
def get_mobjects_from(self, element): def get_mobjects_from(self, element, style):
result = super().get_mobjects_from(element) result = super().get_mobjects_from(element, style)
for mob in result: for mob in result:
if not hasattr(mob, "glyph_label"): if not hasattr(mob, "glyph_label"):
mob.glyph_label = -1 mob.glyph_label = -1

View file

@ -134,15 +134,17 @@ class SVGMobject(VMobject):
self.set_width(self.width) self.set_width(self.width)
def init_colors(self, override=False): def init_colors(self, override=False):
super().init_colors(override=False) super().init_colors(override=override)
def init_points(self): def init_points(self):
doc = minidom.parse(self.file_path) doc = minidom.parse(self.file_path)
self.ref_to_element = {} self.ref_to_element = {}
for child in doc.childNodes: for child in doc.childNodes:
if not isinstance(child, minidom.Element): continue if not isinstance(child, minidom.Element):
if child.tagName != 'svg': continue continue
if child.tagName != 'svg':
continue
mobjects = self.get_mobjects_from(child, dict()) mobjects = self.get_mobjects_from(child, dict())
if self.unpack_groups: if self.unpack_groups:
self.add(*mobjects) self.add(*mobjects)

View file

@ -85,6 +85,9 @@ class Text(SVGMobject):
if self.height is None: if self.height is None:
self.scale(TEXT_MOB_SCALE_FACTOR) self.scale(TEXT_MOB_SCALE_FACTOR)
def init_colors(self, override=True):
super().init_colors(override=override)
def remove_empty_path(self, file_name): def remove_empty_path(self, file_name):
with open(file_name, 'r') as fpr: with open(file_name, 'r') as fpr:
content = fpr.read() content = fpr.read()