mirror of
https://github.com/3b1b/manim.git
synced 2025-09-19 04:41:56 +00:00
Remove camera quality information from constants
This commit is contained in:
parent
05887d5039
commit
5541d55094
3 changed files with 36 additions and 59 deletions
|
@ -28,6 +28,17 @@ tex:
|
|||
universal_import_line: "from manimlib.imports import *"
|
||||
style:
|
||||
background_color: "#333333"
|
||||
quality:
|
||||
resolution: "1920x1080"
|
||||
frame_rate: 30
|
||||
camera_qualities:
|
||||
low:
|
||||
resolution: "854x480"
|
||||
frame_rate: 15
|
||||
medium:
|
||||
resolution: "1280x720"
|
||||
frame_rate: 30
|
||||
high:
|
||||
resolution: "1920x1080"
|
||||
frame_rate: 30
|
||||
ultra_high:
|
||||
resolution: "3840x2160"
|
||||
frame_rate: 60
|
||||
default_quality: "high"
|
||||
|
|
|
@ -4,12 +4,9 @@ import inspect
|
|||
import importlib
|
||||
import os
|
||||
import sys
|
||||
import types
|
||||
import yaml
|
||||
from screeninfo import get_monitors
|
||||
|
||||
import manimlib.constants
|
||||
|
||||
|
||||
def parse_cli():
|
||||
try:
|
||||
|
@ -143,15 +140,6 @@ def get_manim_dir():
|
|||
|
||||
|
||||
def get_module(file_name):
|
||||
# if file_name == "-":
|
||||
# module = types.ModuleType("input_scenes")
|
||||
# code = "from manimlib.imports import *\n\n" + sys.stdin.read()
|
||||
# try:
|
||||
# exec(code, module.__dict__)
|
||||
# return module
|
||||
# except Exception as e:
|
||||
# print(f"Failed to render scene: {str(e)}")
|
||||
# sys.exit(2)
|
||||
if file_name is None:
|
||||
return None
|
||||
else:
|
||||
|
@ -244,29 +232,32 @@ def get_configuration(args):
|
|||
|
||||
def get_camera_configuration(args, custom_defaults):
|
||||
camera_config = {}
|
||||
camera_qualities = get_custom_defaults()["camera_qualities"]
|
||||
if args.low_quality:
|
||||
camera_config.update(manimlib.constants.LOW_QUALITY_CAMERA_CONFIG)
|
||||
quality = camera_qualities["low"]
|
||||
elif args.medium_quality:
|
||||
camera_config.update(manimlib.constants.MEDIUM_QUALITY_CAMERA_CONFIG)
|
||||
quality = camera_qualities["medium"]
|
||||
elif args.hd:
|
||||
camera_config.update(manimlib.constants.HIGH_QUALITY_CAMERA_CONFIG)
|
||||
quality = camera_qualities["high"]
|
||||
elif args.uhd:
|
||||
camera_config.update(manimlib.constants.UHD_QUALITY_CAMERA_CONFIG)
|
||||
else: # No preset quality specified
|
||||
resolution = args.resolution or custom_defaults["quality"]["resolution"]
|
||||
if "x" in resolution:
|
||||
width_str, height_str = resolution.split("x")
|
||||
width = int(width_str)
|
||||
height = int(height_str)
|
||||
else:
|
||||
height = int(resolution)
|
||||
width = int(16 * height / 9)
|
||||
frame_rate = args.frame_rate or custom_defaults["quality"]["frame_rate"]
|
||||
camera_config.update({
|
||||
"pixel_width": width,
|
||||
"pixel_height": height,
|
||||
"frame_rate": frame_rate,
|
||||
})
|
||||
quality = camera_qualities["ultra_high"]
|
||||
else:
|
||||
quality = camera_qualities[camera_qualities["default_quality"]]
|
||||
|
||||
if args.resolution:
|
||||
quality["resolution"] = args.resolution
|
||||
if args.frame_rate:
|
||||
quality["frame_rate"] = int(args.frame_rate)
|
||||
|
||||
width_str, height_str = quality["resolution"].split("x")
|
||||
width = int(width_str)
|
||||
height = int(height_str)
|
||||
|
||||
camera_config.update({
|
||||
"pixel_width": width,
|
||||
"pixel_height": height,
|
||||
"frame_rate": quality["frame_rate"],
|
||||
})
|
||||
|
||||
try:
|
||||
bg_color = args.color or custom_defaults["style"]["background_color"]
|
||||
|
|
|
@ -73,31 +73,6 @@ ITALIC = 'ITALIC'
|
|||
OBLIQUE = 'OBLIQUE'
|
||||
BOLD = 'BOLD'
|
||||
|
||||
|
||||
LOW_QUALITY_CAMERA_CONFIG = {
|
||||
"pixel_height": 480,
|
||||
"pixel_width": 854,
|
||||
"frame_rate": 15,
|
||||
}
|
||||
|
||||
MEDIUM_QUALITY_CAMERA_CONFIG = {
|
||||
"pixel_height": 720,
|
||||
"pixel_width": 1280,
|
||||
"frame_rate": 30,
|
||||
}
|
||||
|
||||
HIGH_QUALITY_CAMERA_CONFIG = {
|
||||
"pixel_height": 1080,
|
||||
"pixel_width": 1920,
|
||||
"frame_rate": 60,
|
||||
}
|
||||
|
||||
UHD_QUALITY_CAMERA_CONFIG = {
|
||||
"pixel_height": 2160,
|
||||
"pixel_width": 3840,
|
||||
"frame_rate": 60,
|
||||
}
|
||||
|
||||
DEFAULT_STROKE_WIDTH = 4
|
||||
|
||||
# Colors
|
||||
|
|
Loading…
Add table
Reference in a new issue