mirror of
https://github.com/3b1b/manim.git
synced 2025-04-13 09:47:07 +00:00
No need for the shortcuts into the manim_config
This commit is contained in:
parent
fce92347fa
commit
13fdc9629d
3 changed files with 7 additions and 39 deletions
|
@ -288,8 +288,8 @@ def update_scene_config(config: dict, args: Namespace):
|
||||||
scene_config = config["scene"]
|
scene_config = config["scene"]
|
||||||
start, end = get_animations_numbers(args)
|
start, end = get_animations_numbers(args)
|
||||||
scene_config.update(
|
scene_config.update(
|
||||||
# Note, Scene.__init__ makes use of both get_camera_config() and
|
# Note, Scene.__init__ makes use of both manimlib.camera and
|
||||||
# get_file_writer_config() below, so the arguments here are just for
|
# manimlib.file_writer below, so the arguments here are just for
|
||||||
# any future specifications beyond what the global configuration holds
|
# any future specifications beyond what the global configuration holds
|
||||||
camera_config=dict(),
|
camera_config=dict(),
|
||||||
file_writer_config=dict(),
|
file_writer_config=dict(),
|
||||||
|
@ -382,34 +382,4 @@ def get_output_directory(args: Namespace, config: dict) -> str:
|
||||||
|
|
||||||
|
|
||||||
# Create global configuration
|
# Create global configuration
|
||||||
|
|
||||||
|
|
||||||
manim_config: Dict = initialize_manim_config()
|
manim_config: Dict = initialize_manim_config()
|
||||||
|
|
||||||
|
|
||||||
# Shortcuts for retrieving portions of global configuration
|
|
||||||
|
|
||||||
|
|
||||||
def get_window_config() -> dict:
|
|
||||||
""" Key word arguments for Window """
|
|
||||||
return manim_config.window
|
|
||||||
|
|
||||||
|
|
||||||
def get_camera_config() -> dict:
|
|
||||||
""" Key word arguments for Camera """
|
|
||||||
return manim_config.camera
|
|
||||||
|
|
||||||
|
|
||||||
def get_file_writer_config() -> dict:
|
|
||||||
""" Key word arguments for SceneFileWriter """
|
|
||||||
return manim_config.file_writer
|
|
||||||
|
|
||||||
|
|
||||||
def get_scene_config() -> dict:
|
|
||||||
""" Key word arguments for Scene """
|
|
||||||
return manim_config.scene
|
|
||||||
|
|
||||||
|
|
||||||
def get_run_config():
|
|
||||||
return manim_config.run
|
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,7 @@ from tqdm.auto import tqdm as ProgressDisplay
|
||||||
from manimlib.animation.animation import prepare_animation
|
from manimlib.animation.animation import prepare_animation
|
||||||
from manimlib.camera.camera import Camera
|
from manimlib.camera.camera import Camera
|
||||||
from manimlib.camera.camera_frame import CameraFrame
|
from manimlib.camera.camera_frame import CameraFrame
|
||||||
from manimlib.config import get_camera_config
|
from manimlib.config import manim_config
|
||||||
from manimlib.config import get_file_writer_config
|
|
||||||
from manimlib.event_handler import EVENT_DISPATCHER
|
from manimlib.event_handler import EVENT_DISPATCHER
|
||||||
from manimlib.event_handler.event_type import EventType
|
from manimlib.event_handler.event_type import EventType
|
||||||
from manimlib.logger import log
|
from manimlib.logger import log
|
||||||
|
@ -90,12 +89,12 @@ class Scene(object):
|
||||||
self.default_wait_time = default_wait_time
|
self.default_wait_time = default_wait_time
|
||||||
|
|
||||||
self.camera_config = merge_dicts_recursively(
|
self.camera_config = merge_dicts_recursively(
|
||||||
get_camera_config(), # Global default
|
manim_config.camera, # Global default
|
||||||
self.default_camera_config, # Updated configuration that subclasses may specify
|
self.default_camera_config, # Updated configuration that subclasses may specify
|
||||||
camera_config, # Updated configuration from instantiation
|
camera_config, # Updated configuration from instantiation
|
||||||
)
|
)
|
||||||
self.file_writer_config = merge_dicts_recursively(
|
self.file_writer_config = merge_dicts_recursively(
|
||||||
get_file_writer_config(),
|
manim_config.file_writer,
|
||||||
self.default_file_writer_config,
|
self.default_file_writer_config,
|
||||||
file_writer_config,
|
file_writer_config,
|
||||||
)
|
)
|
||||||
|
|
|
@ -10,7 +10,7 @@ import numpy as np
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
|
|
||||||
from manimlib.config import parse_cli
|
from manimlib.config import parse_cli
|
||||||
from manimlib.config import get_camera_config
|
from manimlib.config import manim_config
|
||||||
from manimlib.utils.shaders import get_shader_code_from_file
|
from manimlib.utils.shaders import get_shader_code_from_file
|
||||||
from manimlib.utils.shaders import get_shader_program
|
from manimlib.utils.shaders import get_shader_program
|
||||||
from manimlib.utils.shaders import image_path_to_texture
|
from manimlib.utils.shaders import image_path_to_texture
|
||||||
|
@ -410,8 +410,7 @@ class VShaderWrapper(ShaderWrapper):
|
||||||
which can display that texture as a simple quad onto a screen,
|
which can display that texture as a simple quad onto a screen,
|
||||||
along with the rgb value which is meant to be discarded.
|
along with the rgb value which is meant to be discarded.
|
||||||
"""
|
"""
|
||||||
cam_config = get_camera_config()
|
size = manim_config.camera.resolution
|
||||||
size = cam_config["resolution"]
|
|
||||||
double_size = (2 * size[0], 2 * size[1])
|
double_size = (2 * size[0], 2 * size[1])
|
||||||
|
|
||||||
# Important to make sure dtype is floating point (not fixed point)
|
# Important to make sure dtype is floating point (not fixed point)
|
||||||
|
|
Loading…
Add table
Reference in a new issue