mirror of
https://github.com/3b1b/manim.git
synced 2025-04-13 09:47:07 +00:00
Don't show animation progress bar by default
This commit is contained in:
parent
7c233123a1
commit
52259af5df
2 changed files with 22 additions and 11 deletions
|
@ -148,6 +148,11 @@ def parse_cli():
|
||||||
action="store_true",
|
action="store_true",
|
||||||
help="Leave progress bars displayed in terminal",
|
help="Leave progress bars displayed in terminal",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--show_animation_progress",
|
||||||
|
action="store_true",
|
||||||
|
help="Show progress bar for each animation",
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--video_dir",
|
"--video_dir",
|
||||||
help="Directory to write video",
|
help="Directory to write video",
|
||||||
|
@ -365,6 +370,7 @@ def get_configuration(args):
|
||||||
"preview": not write_file,
|
"preview": not write_file,
|
||||||
"presenter_mode": args.presenter_mode,
|
"presenter_mode": args.presenter_mode,
|
||||||
"leave_progress_bars": args.leave_progress_bars,
|
"leave_progress_bars": args.leave_progress_bars,
|
||||||
|
"show_animation_progress": args.show_animation_progress,
|
||||||
}
|
}
|
||||||
|
|
||||||
# Camera configuration
|
# Camera configuration
|
||||||
|
|
|
@ -62,6 +62,7 @@ class Scene(object):
|
||||||
"leave_progress_bars": False,
|
"leave_progress_bars": False,
|
||||||
"preview": True,
|
"preview": True,
|
||||||
"presenter_mode": False,
|
"presenter_mode": False,
|
||||||
|
"show_animation_progress": False,
|
||||||
"linger_after_completion": True,
|
"linger_after_completion": True,
|
||||||
"pan_sensitivity": 3,
|
"pan_sensitivity": 3,
|
||||||
"max_num_saved_states": 50,
|
"max_num_saved_states": 50,
|
||||||
|
@ -88,8 +89,11 @@ class Scene(object):
|
||||||
self.skip_time: float = 0
|
self.skip_time: float = 0
|
||||||
self.original_skipping_status: bool = self.skip_animations
|
self.original_skipping_status: bool = self.skip_animations
|
||||||
self.checkpoint_states: dict[str, list[tuple[Mobject, Mobject]]] = dict()
|
self.checkpoint_states: dict[str, list[tuple[Mobject, Mobject]]] = dict()
|
||||||
|
|
||||||
if self.start_at_animation_number is not None:
|
if self.start_at_animation_number is not None:
|
||||||
self.skip_animations = True
|
self.skip_animations = True
|
||||||
|
if self.file_writer.has_progress_display:
|
||||||
|
self.show_animation_progress = False
|
||||||
|
|
||||||
# Items associated with interaction
|
# Items associated with interaction
|
||||||
self.mouse_point = Point()
|
self.mouse_point = Point()
|
||||||
|
@ -446,21 +450,22 @@ class Scene(object):
|
||||||
) -> list[float] | np.ndarray | ProgressDisplay:
|
) -> list[float] | np.ndarray | ProgressDisplay:
|
||||||
if self.skip_animations and not override_skip_animations:
|
if self.skip_animations and not override_skip_animations:
|
||||||
return [run_time]
|
return [run_time]
|
||||||
else:
|
|
||||||
step = 1 / self.camera.frame_rate
|
times = np.arange(0, run_time, 1 / self.camera.frame_rate)
|
||||||
times = np.arange(0, run_time, step)
|
|
||||||
|
|
||||||
if self.file_writer.has_progress_display:
|
if self.file_writer.has_progress_display:
|
||||||
self.file_writer.set_progress_display_subdescription(desc)
|
self.file_writer.set_progress_display_subdescription(desc)
|
||||||
return times
|
|
||||||
|
|
||||||
return ProgressDisplay(
|
if self.show_animation_progress:
|
||||||
times,
|
return ProgressDisplay(
|
||||||
total=n_iterations,
|
times,
|
||||||
leave=self.leave_progress_bars,
|
total=n_iterations,
|
||||||
ascii=True if platform.system() == 'Windows' else None,
|
leave=self.leave_progress_bars,
|
||||||
desc=desc,
|
ascii=True if platform.system() == 'Windows' else None,
|
||||||
)
|
desc=desc,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
return times
|
||||||
|
|
||||||
def get_run_time(self, animations: Iterable[Animation]) -> float:
|
def get_run_time(self, animations: Iterable[Animation]) -> float:
|
||||||
return np.max([animation.run_time for animation in animations])
|
return np.max([animation.run_time for animation in animations])
|
||||||
|
|
Loading…
Add table
Reference in a new issue