Skip to content

Commit

Permalink
Make default_wait_time a piece of scene configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
3b1b committed Dec 11, 2024
1 parent 2c43d29 commit c9b6ee5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
4 changes: 0 additions & 4 deletions manimlib/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@
DEFAULT_MOBJECT_TO_MOBJECT_BUFFER: float = GLOBAL_CONFIG["sizes"]["default_mobject_to_mobject_buff"]


# In seconds
DEFAULT_WAIT_TIME: float = GLOBAL_CONFIG["default_wait_time"]


# Standard vectors
ORIGIN: Vect3 = np.array([0., 0., 0.])
UP: Vect3 = np.array([0., 1., 0.])
Expand Down
4 changes: 2 additions & 2 deletions manimlib/default_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ scene:
# but defaults can be set here
show_animation_progress: False
leave_progress_bars: False
# How long does a scene pause on Scene.wait calls
default_wait_time: 1.0
style:
tex_template: "default"
font: "Consolas"
Expand Down Expand Up @@ -142,8 +144,6 @@ colors:
light_pink: "#DC75CD"
green_screen: "#00FF00"
orange: "#FF862F"
# How long does a scene pause on Scene.wait calls
default_wait_time: 1.0
# What command to use for ffmpeg
ffmpeg_bin: "ffmpeg"
universal_import_line: "from manimlib import *"
Expand Down
9 changes: 6 additions & 3 deletions manimlib/scene/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
from manimlib.config import get_camera_config
from manimlib.config import get_file_writer_config
from manimlib.constants import ARROW_SYMBOLS
from manimlib.constants import DEFAULT_WAIT_TIME
from manimlib.event_handler import EVENT_DISPATCHER
from manimlib.event_handler.event_type import EventType
from manimlib.logger import log
Expand Down Expand Up @@ -80,14 +79,16 @@ def __init__(
show_animation_progress: bool = False,
leave_progress_bars: bool = False,
presenter_mode: bool = False,
default_wait_time: float = 1.0,
):
self.skip_animations = skip_animations
self.always_update_mobjects = always_update_mobjects
self.start_at_animation_number = start_at_animation_number
self.end_at_animation_number = end_at_animation_number
self.show_animation_progress = show_animation_progress
self.leave_progress_bars = leave_progress_bars
self.presenter_mode = presenter_mode
self.show_animation_progress = show_animation_progress
self.default_wait_time = default_wait_time

self.camera_config = merge_dicts_recursively(
get_camera_config(), # Global default
Expand Down Expand Up @@ -593,11 +594,13 @@ def play(

def wait(
self,
duration: float = DEFAULT_WAIT_TIME,
duration: Optional[float] = None,
stop_condition: Callable[[], bool] = None,
note: str = None,
ignore_presenter_mode: bool = False
):
if duration is None:
duration = self.default_wait_time
self.pre_play()
self.update_mobjects(dt=0) # Any problems with this?
if self.presenter_mode and not self.skip_animations and not ignore_presenter_mode:
Expand Down

0 comments on commit c9b6ee5

Please sign in to comment.