A community-maintained Python framework for creating mathematical animations.
Better convention for -n flag
Grant Sanderson9cfab5c2ed3c
diff --git a/extract_scene.py b/extract_scene.pyindex ea34fa060..605b45130 100644--- a/extract_scene.py+++ b/extract_scene.py@@ -68,7 +68,7 @@ def get_configuration():for short_arg, long_arg in optional_args:parser.add_argument(short_arg, long_arg, action = "store_true")parser.add_argument("-o", "--output_name")- parser.add_argument("-n", "--skip_to_animation_number")+ parser.add_argument("-n", "--start_at_animation_number")args = parser.parse_args()except argparse.ArgumentError as err:print(str(err))@@ -88,8 +88,8 @@ def get_configuration():"ignore_waits" : args.preview,"write_all" : args.write_all,"output_name" : args.output_name,- "skip_to_animation_number" : args.skip_to_animation_number,- "end_after_animation_number" : None,+ "start_at_animation_number" : args.start_at_animation_number,+ "end_at_animation_number" : None,}if args.low_quality:config["camera_config"] = LOW_QUALITY_CAMERA_CONFIG@@ -101,18 +101,18 @@ def get_configuration():config["camera_config"] = PRODUCTION_QUALITY_CAMERA_CONFIGconfig["frame_duration"] = PRODUCTION_QUALITY_FRAME_DURATION- stan = config["skip_to_animation_number"]+ stan = config["start_at_animation_number"]if stan is not None:if "," in stan:start, end = stan.split(",")- config["skip_to_animation_number"] = int(start)- config["end_after_animation_number"] = int(end)+ config["start_at_animation_number"] = int(start)+ config["end_at_animation_number"] = int(end)else:- config["skip_to_animation_number"] = int(stan)+ config["start_at_animation_number"] = int(stan)config["skip_animations"] = any([config["show_last_frame"] and not config["write_to_movie"],- config["skip_to_animation_number"],+ config["start_at_animation_number"],])return config@@ -226,8 +226,8 @@ def main():"write_to_movie","output_directory","save_pngs",- "skip_to_animation_number",- "end_after_animation_number",+ "start_at_animation_number",+ "end_at_animation_number",]])diff --git a/scene/scene.py b/scene/scene.pyindex 625145f46..1cb81bffb 100644--- a/scene/scene.py+++ b/scene/scene.py@@ -39,8 +39,8 @@ class Scene(Container):"name" : None,"always_continually_update" : False,"random_seed" : 0,- "skip_to_animation_number" : None,- "end_after_animation_number" : None,+ "start_at_animation_number" : None,+ "end_at_animation_number" : None,}def __init__(self, **kwargs):Container.__init__(self, **kwargs) # Perhaps allow passing in a non-empty *mobjects parameter?@@ -407,18 +407,17 @@ class Scene(Container):if len(args) == 0:warnings.warn("Called Scene.play with no animations")return- if self.skip_to_animation_number:- if self.num_plays + 1 == self.skip_to_animation_number:+ if self.start_at_animation_number:+ if self.num_plays == self.start_at_animation_number:self.skip_animations = False- if self.end_after_animation_number:- if self.num_plays >= self.end_after_animation_number:+ if self.end_at_animation_number:+ if self.num_plays >= self.end_at_animation_number:self.skip_animations = Truereturn self #Don't even both with the rest...if self.skip_animations:kwargs["run_time"] = 0animations = self.compile_play_args_to_animation_list(*args)- self.num_plays += 1sync_animation_run_times_and_rate_funcs(*animations, **kwargs)moving_mobjects = self.get_moving_mobjects(*animations)@@ -434,6 +433,7 @@ class Scene(Container):self.mobjects_from_last_animation = moving_mobjectsself.clean_up_animations(*animations)self.continual_update(0)+ self.num_plays += 1return selfdef clean_up_animations(self, *animations):