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 *"
|
universal_import_line: "from manimlib.imports import *"
|
||||||
style:
|
style:
|
||||||
background_color: "#333333"
|
background_color: "#333333"
|
||||||
quality:
|
camera_qualities:
|
||||||
resolution: "1920x1080"
|
low:
|
||||||
frame_rate: 30
|
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 importlib
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import types
|
|
||||||
import yaml
|
import yaml
|
||||||
from screeninfo import get_monitors
|
from screeninfo import get_monitors
|
||||||
|
|
||||||
import manimlib.constants
|
|
||||||
|
|
||||||
|
|
||||||
def parse_cli():
|
def parse_cli():
|
||||||
try:
|
try:
|
||||||
|
@ -143,15 +140,6 @@ def get_manim_dir():
|
||||||
|
|
||||||
|
|
||||||
def get_module(file_name):
|
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:
|
if file_name is None:
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
|
@ -244,29 +232,32 @@ def get_configuration(args):
|
||||||
|
|
||||||
def get_camera_configuration(args, custom_defaults):
|
def get_camera_configuration(args, custom_defaults):
|
||||||
camera_config = {}
|
camera_config = {}
|
||||||
|
camera_qualities = get_custom_defaults()["camera_qualities"]
|
||||||
if args.low_quality:
|
if args.low_quality:
|
||||||
camera_config.update(manimlib.constants.LOW_QUALITY_CAMERA_CONFIG)
|
quality = camera_qualities["low"]
|
||||||
elif args.medium_quality:
|
elif args.medium_quality:
|
||||||
camera_config.update(manimlib.constants.MEDIUM_QUALITY_CAMERA_CONFIG)
|
quality = camera_qualities["medium"]
|
||||||
elif args.hd:
|
elif args.hd:
|
||||||
camera_config.update(manimlib.constants.HIGH_QUALITY_CAMERA_CONFIG)
|
quality = camera_qualities["high"]
|
||||||
elif args.uhd:
|
elif args.uhd:
|
||||||
camera_config.update(manimlib.constants.UHD_QUALITY_CAMERA_CONFIG)
|
quality = camera_qualities["ultra_high"]
|
||||||
else: # No preset quality specified
|
else:
|
||||||
resolution = args.resolution or custom_defaults["quality"]["resolution"]
|
quality = camera_qualities[camera_qualities["default_quality"]]
|
||||||
if "x" in resolution:
|
|
||||||
width_str, height_str = resolution.split("x")
|
if args.resolution:
|
||||||
width = int(width_str)
|
quality["resolution"] = args.resolution
|
||||||
height = int(height_str)
|
if args.frame_rate:
|
||||||
else:
|
quality["frame_rate"] = int(args.frame_rate)
|
||||||
height = int(resolution)
|
|
||||||
width = int(16 * height / 9)
|
width_str, height_str = quality["resolution"].split("x")
|
||||||
frame_rate = args.frame_rate or custom_defaults["quality"]["frame_rate"]
|
width = int(width_str)
|
||||||
camera_config.update({
|
height = int(height_str)
|
||||||
"pixel_width": width,
|
|
||||||
"pixel_height": height,
|
camera_config.update({
|
||||||
"frame_rate": frame_rate,
|
"pixel_width": width,
|
||||||
})
|
"pixel_height": height,
|
||||||
|
"frame_rate": quality["frame_rate"],
|
||||||
|
})
|
||||||
|
|
||||||
try:
|
try:
|
||||||
bg_color = args.color or custom_defaults["style"]["background_color"]
|
bg_color = args.color or custom_defaults["style"]["background_color"]
|
||||||
|
|
|
@ -73,31 +73,6 @@ ITALIC = 'ITALIC'
|
||||||
OBLIQUE = 'OBLIQUE'
|
OBLIQUE = 'OBLIQUE'
|
||||||
BOLD = 'BOLD'
|
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
|
DEFAULT_STROKE_WIDTH = 4
|
||||||
|
|
||||||
# Colors
|
# Colors
|
||||||
|
|
Loading…
Add table
Reference in a new issue