mirror of
https://github.com/3b1b/manim.git
synced 2025-08-31 20:08:29 +00:00
A few fixes to the last commit, making sure different file extensions don't mess with the system
This commit is contained in:
parent
2419fbcc53
commit
8931a88b3f
4 changed files with 13 additions and 6 deletions
|
@ -213,7 +213,6 @@ class PiCreatureScene(Scene):
|
|||
time_to_blink = self.total_wait_time % self.seconds_to_blink == 0
|
||||
if blink and self.any_pi_creatures_on_screen() and time_to_blink:
|
||||
self.blink()
|
||||
self.num_plays -= 1 # This shouldn't count as an animation
|
||||
else:
|
||||
self.non_blink_wait()
|
||||
time -= 1
|
||||
|
|
|
@ -661,6 +661,7 @@ class Scene(Container):
|
|||
# should be transparent.
|
||||
command += [
|
||||
'-vcodec', 'qtrle',
|
||||
# '-vcodec', 'png',
|
||||
]
|
||||
else:
|
||||
command += [
|
||||
|
@ -688,7 +689,8 @@ class Scene(Container):
|
|||
def combine_movie_files(self):
|
||||
partial_movie_file_directory = self.get_partial_movie_directory()
|
||||
kwargs = {
|
||||
"remove_non_integer_files": True
|
||||
"remove_non_integer_files": True,
|
||||
"extension": self.movie_file_extension,
|
||||
}
|
||||
if self.start_at_animation_number is not None:
|
||||
kwargs["min_index"] = self.start_at_animation_number
|
||||
|
|
|
@ -50,7 +50,9 @@ def get_sorted_integer_files(directory,
|
|||
min_index=0,
|
||||
max_index=np.inf,
|
||||
remove_non_integer_files=False,
|
||||
remove_indices_greater_than=None):
|
||||
remove_indices_greater_than=None,
|
||||
extension=None,
|
||||
):
|
||||
indexed_files = []
|
||||
for file in os.listdir(directory):
|
||||
if '.' in file:
|
||||
|
@ -65,6 +67,8 @@ def get_sorted_integer_files(directory,
|
|||
if index > remove_indices_greater_than:
|
||||
os.remove(full_path)
|
||||
continue
|
||||
if extension is not None and not file.endswith(extension):
|
||||
continue
|
||||
if index >= min_index and index < max_index:
|
||||
indexed_files.append((index, file))
|
||||
elif remove_non_integer_files:
|
||||
|
|
|
@ -53,10 +53,12 @@ def stage_animations(module_name):
|
|||
scene_class, **output_directory_kwargs
|
||||
)
|
||||
if os.path.exists(pmf_dir):
|
||||
for file in get_sorted_integer_files(pmf_dir):
|
||||
sorted_files.append(
|
||||
os.path.join(pmf_dir, file)
|
||||
for extension in [".mov", ".mp4"]:
|
||||
int_files = get_sorted_integer_files(
|
||||
pmf_dir, extension=extension
|
||||
)
|
||||
for file in int_files:
|
||||
sorted_files.append(os.path.join(pmf_dir, file))
|
||||
else:
|
||||
for clip in [f for f in files if f.startswith(scene_name + ".")]:
|
||||
sorted_files.append(os.path.join(animation_dir, clip))
|
||||
|
|
Loading…
Add table
Reference in a new issue