Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

A few fixes to the last commit, making sure different file extensions don't mess with the system

Grant Sanderson8931a88b3fc4
diff --git a/manimlib/for_3b1b_videos/pi_creature_scene.py b/manimlib/for_3b1b_videos/pi_creature_scene.py
index a30dcd20a..ee36564ce 100644
--- a/manimlib/for_3b1b_videos/pi_creature_scene.py
+++ b/manimlib/for_3b1b_videos/pi_creature_scene.py
@@ -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
diff --git a/manimlib/scene/scene.py b/manimlib/scene/scene.py
index c4217fe48..ab60ce772 100644
--- a/manimlib/scene/scene.py
+++ b/manimlib/scene/scene.py
@@ -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
diff --git a/manimlib/utils/output_directory_getters.py b/manimlib/utils/output_directory_getters.py
index 0bedad08a..decd1ea27 100644
--- a/manimlib/utils/output_directory_getters.py
+++ b/manimlib/utils/output_directory_getters.py
@@ -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:
diff --git a/stage_scenes.py b/stage_scenes.py
index 64c6d2491..53b099d70 100644
--- a/stage_scenes.py
+++ b/stage_scenes.py
@@ -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))