mirror of
https://github.com/3b1b/manim.git
synced 2025-09-19 04:41:56 +00:00
Merge branch 'master' of github.com:3b1b/manim into video-work
This commit is contained in:
commit
7fbbeb68ec
4 changed files with 21 additions and 0 deletions
|
@ -63,6 +63,7 @@ flag abbr function
|
|||
``--video_dir VIDEO_DIR`` Directory to write video
|
||||
``--config_file CONFIG_FILE`` Path to the custom configuration file
|
||||
``--log-level LOG_LEVEL`` Level of messages to Display, can be DEBUG / INFO / WARNING / ERROR / CRITICAL
|
||||
``--autoreload`` Automatically reload Python modules to pick up code changes across different files
|
||||
========================================================== ====== =====================================================================================================================================================================================================
|
||||
|
||||
custom_config
|
||||
|
|
|
@ -45,6 +45,7 @@ def initialize_manim_config() -> Dict:
|
|||
update_file_writer_config(config, args)
|
||||
update_scene_config(config, args)
|
||||
update_run_config(config, args)
|
||||
update_embed_config(config, args)
|
||||
|
||||
return Dict(config)
|
||||
|
||||
|
@ -210,6 +211,12 @@ def parse_cli():
|
|||
"--log-level",
|
||||
help="Level of messages to Display, can be DEBUG / INFO / WARNING / ERROR / CRITICAL"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--autoreload",
|
||||
action="store_true",
|
||||
help="Automatically reload Python modules to pick up code changes " +
|
||||
"across different files",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
args.write_file = any([args.write_file, args.open, args.finder])
|
||||
return args
|
||||
|
@ -312,6 +319,11 @@ def update_run_config(config: dict, args: Namespace):
|
|||
)
|
||||
|
||||
|
||||
def update_embed_config(config: dict, args: Namespace):
|
||||
if args.autoreload:
|
||||
config["embed"]["autoreload"] = True
|
||||
|
||||
|
||||
# Helpers for the functions above
|
||||
|
||||
|
||||
|
|
|
@ -76,6 +76,7 @@ text:
|
|||
alignment: "LEFT"
|
||||
embed:
|
||||
exception_mode: "Verbose"
|
||||
autoreload: False
|
||||
resolution_options:
|
||||
# When the user passes in -l, -m, --hd or --uhd, these are the corresponding
|
||||
# resolutions
|
||||
|
|
|
@ -29,6 +29,8 @@ class InteractiveSceneEmbed:
|
|||
self.enable_gui()
|
||||
self.ensure_frame_update_post_cell()
|
||||
self.ensure_flash_on_error()
|
||||
if manim_config.embed.autoreload:
|
||||
self.auto_reload()
|
||||
|
||||
def launch(self):
|
||||
self.shell()
|
||||
|
@ -139,6 +141,11 @@ class InteractiveSceneEmbed:
|
|||
print("Reloading...")
|
||||
self.shell.run_line_magic("exit_raise", "")
|
||||
|
||||
def auto_reload(self):
|
||||
"""Enables IPython autoreload for automatic reloading of modules."""
|
||||
self.shell.magic("load_ext autoreload")
|
||||
self.shell.magic("autoreload all")
|
||||
|
||||
def checkpoint_paste(
|
||||
self,
|
||||
skip: bool = False,
|
||||
|
|
Loading…
Add table
Reference in a new issue