mirror of
https://github.com/3b1b/manim.git
synced 2025-09-01 00:48:45 +00:00
More intuitive behavior when explicit filenames are provided with extensions
This commit is contained in:
parent
b4b47c8439
commit
1fe0508fb2
2 changed files with 8 additions and 1 deletions
|
@ -689,6 +689,13 @@ class DictAsObject(object):
|
|||
def fdiv(a, b):
|
||||
return np.true_divide(a,b)
|
||||
|
||||
def add_extension_if_not_present(file_name, extension):
|
||||
# This could conceivably be smarter about handling existing differing extensions
|
||||
if(file_name[-len(extension):] != extension):
|
||||
return file_name + extension
|
||||
else:
|
||||
return file_name
|
||||
|
||||
# For debugging purposes
|
||||
|
||||
def print_mobject_family(mob, n_tabs = 0):
|
||||
|
|
|
@ -511,7 +511,7 @@ class Scene(Container):
|
|||
if dont_update:
|
||||
folder = str(self)
|
||||
path = os.path.join(self.output_directory, folder)
|
||||
file_name = (name or str(self)) + ".png"
|
||||
file_name = add_extension_if_not_present(name or str(self), ".png")
|
||||
return os.path.join(path, file_name)
|
||||
|
||||
def save_image(self, name = None, mode = "RGB", dont_update = False):
|
||||
|
|
Loading…
Add table
Reference in a new issue