mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
Fixed -o flag functionality for extract_scene.py
This commit is contained in:
parent
b1e6c9c916
commit
f3eb43f96f
2 changed files with 6 additions and 5 deletions
|
@ -96,7 +96,6 @@ def get_configuration(sys_argv):
|
|||
return config
|
||||
|
||||
def handle_scene(scene, **config):
|
||||
output_name = config["output_name"] or str(scene)
|
||||
if config["quiet"]:
|
||||
curr_stdout = sys.stdout
|
||||
sys.stdout = open(os.devnull, "w")
|
||||
|
@ -106,7 +105,7 @@ def handle_scene(scene, **config):
|
|||
if config["save_image"]:
|
||||
if not config["write_all"]:
|
||||
scene.show_frame()
|
||||
scene.save_image(output_name)
|
||||
scene.save_image()
|
||||
|
||||
if config["quiet"]:
|
||||
sys.stdout.close()
|
||||
|
@ -182,6 +181,7 @@ def main():
|
|||
"output_directory",
|
||||
]
|
||||
])
|
||||
scene_kwargs["name"] = config["output_name"]
|
||||
for SceneClass in get_scene_classes(scene_names_to_classes, config):
|
||||
try:
|
||||
handle_scene(SceneClass(**scene_kwargs), **config)
|
||||
|
|
|
@ -29,6 +29,7 @@ class Scene(object):
|
|||
"write_to_movie" : True,
|
||||
"save_frames" : False,
|
||||
"output_directory" : MOVIE_DIR,
|
||||
"name" : None,
|
||||
}
|
||||
def __init__(self, **kwargs):
|
||||
digest_config(self, kwargs)
|
||||
|
@ -37,6 +38,8 @@ class Scene(object):
|
|||
self.foreground_mobjects = []
|
||||
self.num_plays = 0
|
||||
self.saved_frames = []
|
||||
if self.name is None:
|
||||
self.name = self.__class__.__name__
|
||||
|
||||
self.setup()
|
||||
if self.write_to_movie:
|
||||
|
@ -57,9 +60,7 @@ class Scene(object):
|
|||
pass #To be implemented in subclasses
|
||||
|
||||
def __str__(self):
|
||||
if hasattr(self, "name"):
|
||||
return self.name
|
||||
return self.__class__.__name__
|
||||
return self.name
|
||||
|
||||
def set_name(self, name):
|
||||
self.name = name
|
||||
|
|
Loading…
Add table
Reference in a new issue