mirror of
https://github.com/3b1b/manim.git
synced 2025-04-13 09:47:07 +00:00
Enabled adding end animation number with -n flag
This commit is contained in:
parent
5e25ecd33c
commit
b9ef9f6fc0
2 changed files with 13 additions and 1 deletions
|
@ -89,6 +89,7 @@ def get_configuration():
|
|||
"write_all" : args.write_all,
|
||||
"output_name" : args.output_name,
|
||||
"skip_to_animation_number" : args.skip_to_animation_number,
|
||||
"end_after_animation_number" : None,
|
||||
}
|
||||
if args.low_quality:
|
||||
config["camera_config"] = LOW_QUALITY_CAMERA_CONFIG
|
||||
|
@ -102,7 +103,12 @@ def get_configuration():
|
|||
|
||||
stan = config["skip_to_animation_number"]
|
||||
if stan is not None:
|
||||
config["skip_to_animation_number"] = int(stan)
|
||||
if "," in stan:
|
||||
start, end = stan.split(",")
|
||||
config["skip_to_animation_number"] = int(start)
|
||||
config["end_after_animation_number"] = int(end)
|
||||
else:
|
||||
config["skip_to_animation_number"] = int(stan)
|
||||
|
||||
config["skip_animations"] = any([
|
||||
config["show_last_frame"] and not config["write_to_movie"],
|
||||
|
@ -221,6 +227,7 @@ def main():
|
|||
"output_directory",
|
||||
"save_pngs",
|
||||
"skip_to_animation_number",
|
||||
"end_after_animation_number",
|
||||
]
|
||||
])
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ class Scene(Container):
|
|||
"always_continually_update" : False,
|
||||
"random_seed" : 0,
|
||||
"skip_to_animation_number" : None,
|
||||
"end_after_animation_number" : None,
|
||||
}
|
||||
def __init__(self, **kwargs):
|
||||
Container.__init__(self, **kwargs) # Perhaps allow passing in a non-empty *mobjects parameter?
|
||||
|
@ -409,6 +410,10 @@ class Scene(Container):
|
|||
if self.skip_to_animation_number:
|
||||
if self.num_plays + 1 == self.skip_to_animation_number:
|
||||
self.skip_animations = False
|
||||
if self.end_after_animation_number:
|
||||
if self.num_plays >= self.end_after_animation_number:
|
||||
self.skip_animations = True
|
||||
return self #Don't even both with the rest...
|
||||
if self.skip_animations:
|
||||
kwargs["run_time"] = 0
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue