-
Notifications
You must be signed in to change notification settings - Fork 5.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attempt to refactor SVGMobject with svgelements #1731
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TonyCrane
approved these changes
Feb 11, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Try using external library
svgelements
to refactor SVGMobject.Proposed changes
manimlib/mobject/svg/svg_mobject.py
: usesvgelements
to parse svg filesmanimlib/mobject/svg/tex_mobject.py
: removeoverride
attribute frominit_colors
method; cut off global style-applying process frominit_colors
manimlib/mobject/svg/text_mobject.py
: removeinit_colors
inheritance; addset_fill
process since svg files rendered byText
have the black color specifiedmanimlib/mobject/svg/mtex_mobject.py
: replace.fill_color
with.get_fill_color()
manimlib/mobject/mobject.py
: removeoverride
attribute frominit_colors
methodmanimlib/mobject/geometry.py
: addPolyline
class; removeoverride
attribute frominit_colors
methodmanimlib/mobject/types/surface.py
: removeoverride
attribute frominit_colors
methodmanimlib/mobject/types/vectorized_mobject.py
: removeoverride
attribute frominit_colors
methodrequirements.txt
: update requirements (addsvgelements
, removecssselect2
)setup.cfg
: update requirements (addsvgelements
, removecssselect2
)Notes
SVGMobject
, 5 attributes (fill_color
,fill_opacity
,stroke_width
,stroke_color
,stroke_opacity
) depend on the result of style parsing. If not specified, they will be set as default attributes passed toSVGMobject
class.set_fill
,set_stroke
methods can still apply style globally.unpack_groups
attribute is removed as the structure may be modified. NowSVGMobject
always unpacks submobjects.MarkupText
, just likeText
, but I cannot runMarkupText
and cannot look into svg files rendered by it.<text>
tags in svg are still not handled.SingleStringTex
andMTex
both inherit fromSVGMobject
, and in community edition they do. This may also be handled later.