Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Loose ends

Devin Neal9077542c0f61
diff --git a/manim/config.py b/manim/config.py
index 6b86fc5f2..a866eb89d 100644
--- a/manim/config.py
+++ b/manim/config.py
@@ -177,7 +177,7 @@ def _parse_file_writer_config(config_parser, args):
def _parse_cli(arg_list, input=True):
parser = argparse.ArgumentParser(
description='Animation engine for explanatory math videos',
- epilog='Made with <3 by the manim community devs'
+ epilog='Made with ❤ by the manim community devs'
)
if input:
parser.add_argument(
@@ -391,16 +391,19 @@ library_wide = os.path.join(os.path.dirname(__file__), 'default.cfg')
config_files = [
library_wide,
os.path.expanduser('~/.manim.cfg'),
- os.path.join(os.getcwd(), 'manim.cfg'),
]
if _from_command_line():
args = _parse_cli(sys.argv[1:])
- file_config = os.path.join(os.path.dirname(args.file), 'manim.cfg')
- if os.path.exists(file_config):
- config_files.append(file_config)
if args.config_file is not None:
- config_files.append(args.config_file)
+ if os.path.exists(args.config_file):
+ config_files.append(args.config_file)
+ else:
+ raise FileNotFoundError(f"Config file {args.config_file} doesn't exist")
+ else:
+ script_directory_file_config = os.path.join(os.path.dirname(args.file), 'manim.cfg')
+ if os.path.exists(script_directory_file_config):
+ config_files.append(script_directory_file_config)
else:
# In this case, we still need an empty args object.
diff --git a/manim/scene/scene.py b/manim/scene/scene.py
index 766a4e13d..1c26a7def 100644
--- a/manim/scene/scene.py
+++ b/manim/scene/scene.py
@@ -62,7 +62,7 @@ class Scene(Container):
self.foreground_mobjects = []
self.num_plays = 0
self.time = 0
- self.original_skipping_status = self.skip_animations
+ self.original_skipping_status = file_writer_config['skip_animations']
if self.random_seed is not None:
random.seed(self.random_seed)
np.random.seed(self.random_seed)
@@ -234,7 +234,7 @@ class Scene(Container):
**kwargs
"""
- if self.skip_animations and not ignore_skipping:
+ if file_writer_config['skip_animations'] and not ignore_skipping:
return
if mobjects is None:
mobjects = list_update(
@@ -675,7 +675,7 @@ class Scene(Container):
ProgressDisplay
The CommandLine Progress Bar.
"""
- if self.skip_animations and not override_skip_animations:
+ if file_writer_config['skip_animations'] and not override_skip_animations:
times = [run_time]
else:
step = 1 / self.camera.frame_rate
@@ -822,10 +822,10 @@ class Scene(Container):
if file_writer_config['from_animation_number']:
if self.num_plays == file_writer_config['from_animation_number']:
- self.skip_animations = False
+ file_writer_config['skip_animations'] = False
if file_writer_config['upto_animation_number']:
if self.num_plays >= file_writer_config['upto_animation_number']:
- self.skip_animations = True
+ file_writer_config['skip_animations'] = True
raise EndSceneEarlyException()
def handle_play_like_call(func):
@@ -850,7 +850,7 @@ class Scene(Container):
"""
def wrapper(self, *args, **kwargs):
self.update_skipping_status()
- allow_write = not self.skip_animations
+ allow_write = not file_writer_config['skip_animations']
self.file_writer.begin_animation(allow_write)
func(self, *args, **kwargs)
self.file_writer.end_animation(allow_write)
@@ -923,7 +923,7 @@ class Scene(Container):
self.mobjects_from_last_animation = [
anim.mobject for anim in animations
]
- if self.skip_animations:
+ if file_writer_config['skip_animations']:
# TODO, run this call in for each animation?
self.update_mobjects(self.get_run_time(animations))
else:
@@ -1066,7 +1066,7 @@ class Scene(Container):
if stop_condition is not None and stop_condition():
time_progression.close()
break
- elif self.skip_animations:
+ elif file_writer_config['skip_animations']:
# Do nothing
return self
else:
@@ -1135,7 +1135,7 @@ class Scene(Container):
"""
dt = 1 / self.camera.frame_rate
self.increment_time(len(frames) * dt)
- if self.skip_animations:
+ if file_writer_config['skip_animations']:
return
for frame in frames:
self.file_writer.write_frame(frame)