Give the user feedback for SVGs that take a while#1766
Merged
3b1b merged 5 commits into3b1b:masterfrom Mar 28, 2022
Merged
Conversation
TonyCrane
requested changes
Mar 27, 2022
TonyCrane
approved these changes
Mar 28, 2022
Owner
Contributor
Author
|
I agree that will be better, I will refactor. I will commit a change that removes these three lines of code so we get back to the beginning and from there I will add subsequent commits for the tqdm logic. |
Contributor
Author
|
Testing right now, working great. I used delay=3 so that SVGs that run instantly will not flash a progress bar. I will upload video which can take longer than the coding or testing. Guess I would be singing to the choir. |
Contributor
Author
flagtest.mp4 |
Contributor
Author
flashtest.mp4 |
This file contains hidden or 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
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
Manim does not provide feedback to the user while processing a long-running SVG mobject.
Since manim typically runs so fast, a long-running SVG catches the user by surprise. Personally it took me a few hours to figure out that manim was not freezing, rather it was just taking a long time on a complicated SVG.
Proposed changes
This change gives the user some feedback while processing a complicated SVG.
Specifically:
If the SVG has over 100 rings to process, we display a counter to log.info once per 100 processed rings. Thus the user learns manim is working on a long-running operation.
If the SVG has under 100 rings, this change has no effect. Manim will process it quick enough.
Test
Code:
I tested with the Noto emoji - Afghan flag SVG. Here is the complete scene code, which automatically gets the SVG from the internet so no additional files are needed.
Paste into a blank _.py file and run manimgl _.py
Try it without the pull request, and it will seem that manimgl has frozen with a blank screen.
Try it with the pull request, and rest reassured manim is working.
Result: