From c71a4d652abe36e05ec1d46e928f1ee0624db688 Mon Sep 17 00:00:00 2001 From: Ali-Aljufairi Date: Sun, 30 Apr 2023 23:19:34 +0300 Subject: [PATCH 1/2] Added Feature to disable caching This Change will help people with large scene to render faster without losing the qauitly --- .vscode/settings.json | 6 ++++++ git_story/__main__.py | 4 ++++ 2 files changed, 10 insertions(+) create mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..9ee86e7 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "[python]": { + "editor.defaultFormatter": "ms-python.autopep8" + }, + "python.formatting.provider": "none" +} \ No newline at end of file diff --git a/git_story/__main__.py b/git_story/__main__.py index 3ae81d4..28c0b84 100644 --- a/git_story/__main__.py +++ b/git_story/__main__.py @@ -23,6 +23,8 @@ def main(): parser.add_argument("--low-quality", help="Render output video in low quality, useful for faster testing", action="store_true") parser.add_argument("--light-mode", help="Enable light-mode with white background", action="store_true") parser.add_argument("--invert-branches", help="Invert positioning of branches where applicable", action="store_true") + # disable caching to avoid issues with long animations + parser.add_argument("--disable-caching", help="Disable caching to avoid issues with long animations", action="store_true") parser.add_argument("--speed", help="A multiple of the standard 1x animation speed (ex: 2 = twice as fast, 0.5 = half as fast)", type=float, default=1) args = parser.parse_args() @@ -34,6 +36,8 @@ def main(): if ( args.light_mode ): config.background_color = WHITE + if ( args.disable_caching ): + config.disable_caching = True scene = gs.GitStory(args) scene.render() From 3d6b995a394a97ff3b850946e82a48d49a6c4d84 Mon Sep 17 00:00:00 2001 From: Ali-Aljufairi Date: Sun, 30 Apr 2023 23:41:58 +0300 Subject: [PATCH 2/2] removed vscode settings --- .vscode/settings.json | 6 ---- git_story/__main__.py | 65 ++++++++++++++++++++++++++++--------------- 2 files changed, 43 insertions(+), 28 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 9ee86e7..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "[python]": { - "editor.defaultFormatter": "ms-python.autopep8" - }, - "python.formatting.provider": "none" -} \ No newline at end of file diff --git a/git_story/__main__.py b/git_story/__main__.py index 28c0b84..3943949 100644 --- a/git_story/__main__.py +++ b/git_story/__main__.py @@ -5,38 +5,58 @@ from manim import config, WHITE from manim.utils.file_ops import open_file as open_media_file + def main(): - parser = argparse.ArgumentParser("git-story", formatter_class=argparse.ArgumentDefaultsHelpFormatter) - parser.add_argument("--commits", help="The number of commits to display in the Git animation", type=int, default=8) - parser.add_argument("--commit-id", help="The ref (branch/tag), or first 6 characters of the commit to animate backwards from", type=str, default="HEAD") - parser.add_argument("--hide-merged-chains", help="Hide commits from merged branches, i.e. only display mainline commits", action="store_true") - parser.add_argument("--reverse", help="Display commits in reverse order in the Git animation", action="store_true") - parser.add_argument("--title", help="Custom title to display at the beginning of the animation", type=str, default="Git Story, by initialcommit.com") - parser.add_argument("--logo", help="The path to a custom logo to use in the animation intro/outro", type=str, default=os.path.join(str(pathlib.Path(__file__).parent.resolve()), "logo.png")) - parser.add_argument("--outro-top-text", help="Custom text to display above the logo during the outro", type=str, default="Thanks for using Initial Commit!") - parser.add_argument("--outro-bottom-text", help="Custom text to display below the logo during the outro", type=str, default="Learn more at initialcommit.com") - parser.add_argument("--show-intro", help="Add an intro sequence with custom logo and title", action="store_true") - parser.add_argument("--show-outro", help="Add an outro sequence with custom logo and text", action="store_true") - parser.add_argument("--max-branches-per-commit", help="Maximum number of branch labels to display for each commit", type=int, default=2) - parser.add_argument("--max-tags-per-commit", help="Maximum number of tags to display for each commit", type=int, default=1) - parser.add_argument("--media-dir", help="The path to output the animation data and video file", type=str, default=".") - parser.add_argument("--low-quality", help="Render output video in low quality, useful for faster testing", action="store_true") - parser.add_argument("--light-mode", help="Enable light-mode with white background", action="store_true") - parser.add_argument("--invert-branches", help="Invert positioning of branches where applicable", action="store_true") + parser = argparse.ArgumentParser( + "git-story", formatter_class=argparse.ArgumentDefaultsHelpFormatter) + parser.add_argument( + "--commits", help="The number of commits to display in the Git animation", type=int, default=8) + parser.add_argument( + "--commit-id", help="The ref (branch/tag), or first 6 characters of the commit to animate backwards from", type=str, default="HEAD") + parser.add_argument("--hide-merged-chains", + help="Hide commits from merged branches, i.e. only display mainline commits", action="store_true") + parser.add_argument( + "--reverse", help="Display commits in reverse order in the Git animation", action="store_true") + parser.add_argument("--title", help="Custom title to display at the beginning of the animation", + type=str, default="Git Story, by initialcommit.com") + parser.add_argument("--logo", help="The path to a custom logo to use in the animation intro/outro", + type=str, default=os.path.join(str(pathlib.Path(__file__).parent.resolve()), "logo.png")) + parser.add_argument("--outro-top-text", help="Custom text to display above the logo during the outro", + type=str, default="Thanks for using Initial Commit!") + parser.add_argument("--outro-bottom-text", help="Custom text to display below the logo during the outro", + type=str, default="Learn more at initialcommit.com") + parser.add_argument( + "--show-intro", help="Add an intro sequence with custom logo and title", action="store_true") + parser.add_argument( + "--show-outro", help="Add an outro sequence with custom logo and text", action="store_true") + parser.add_argument("--max-branches-per-commit", + help="Maximum number of branch labels to display for each commit", type=int, default=2) + parser.add_argument("--max-tags-per-commit", + help="Maximum number of tags to display for each commit", type=int, default=1) + parser.add_argument( + "--media-dir", help="The path to output the animation data and video file", type=str, default=".") + parser.add_argument( + "--low-quality", help="Render output video in low quality, useful for faster testing", action="store_true") + parser.add_argument( + "--light-mode", help="Enable light-mode with white background", action="store_true") + parser.add_argument( + "--invert-branches", help="Invert positioning of branches where applicable", action="store_true") # disable caching to avoid issues with long animations - parser.add_argument("--disable-caching", help="Disable caching to avoid issues with long animations", action="store_true") - parser.add_argument("--speed", help="A multiple of the standard 1x animation speed (ex: 2 = twice as fast, 0.5 = half as fast)", type=float, default=1) + parser.add_argument( + "--disable-caching", help="Disable caching to avoid issues with long animations", action="store_true") + parser.add_argument( + "--speed", help="A multiple of the standard 1x animation speed (ex: 2 = twice as fast, 0.5 = half as fast)", type=float, default=1) args = parser.parse_args() config.media_dir = os.path.join(args.media_dir, "git-story_media") - if ( args.low_quality ): + if (args.low_quality): config.quality = "low_quality" - if ( args.light_mode ): + if (args.light_mode): config.background_color = WHITE - if ( args.disable_caching ): + if (args.disable_caching): config.disable_caching = True scene = gs.GitStory(args) @@ -47,5 +67,6 @@ def main(): except FileNotFoundError: print("Error automatically opening video player, please manually open the video file to view animation.") + if __name__ == '__main__': main()