-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtest_run.py
More file actions
91 lines (78 loc) · 2.43 KB
/
test_run.py
File metadata and controls
91 lines (78 loc) · 2.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import os
import json
from lablib import (
operators,
processors,
renderers,
utils
)
# System Constants
FFMPEG_PATH = "vendor/bin/ffmpeg/windows/bin"
OIIO_PATH = "vendor/bin/oiio/windows"
OCIO_PATH = "vendor/bin/ocioconfig/OpenColorIOConfigs/aces_1.2/config.ocio"
# Project Constants
SOURCE_DIR = "resources/public/plateMain/v000"
DATA_PATH = "resources/public/mock_data.json"
EFFECT_PATH = "resources/public/effectPlateMain/v000/BLD_010_0010_effectPlateMain_v000.json"
SLATE_TEMPLATE_PATH = "templates/slates/slate_generic/slate_generic.html"
STAGING_DIR = "results"
OUTPUT_WIDTH = 1920
OUTPUT_HEIGHT = 1080
# Env Setup
script_location = os.path.dirname(os.path.realpath(__file__))
os.environ["PATH"] += os.pathsep + os.path.join(script_location, FFMPEG_PATH)
os.environ["PATH"] += os.pathsep + os.path.join(script_location, OIIO_PATH)
os.environ["OCIO"] = OCIO_PATH
# Get data from Asset
with open(DATA_PATH, "r") as f:
working_data = json.loads(f.read())
# Setup SequenceInfo operator
main_seq = operators.SequenceInfo().compute_longest(SOURCE_DIR)
# Read image info from first image in sequence
main_seq_info = utils.read_image_info(main_seq.frames[0])
# Compute Effects file from AYON
epr = processors.EffectsFileProcessor(EFFECT_PATH)
# Compute color transformations
cpr = processors.ColorProcessor(
operators=epr.color_operators,
config_path = OCIO_PATH,
staging_dir = STAGING_DIR,
context = working_data["asset"],
family = working_data["project"]["code"],
views = ["sRGB", "Rec.709", "Log", "Raw"]
)
# Compute repo transformations
rpr = processors.RepoProcessor(
operators = epr.repo_operators,
source_width = main_seq_info.display_width,
source_height = main_seq_info.display_height,
dest_width = OUTPUT_WIDTH,
dest_height = OUTPUT_HEIGHT
)
# Render the sequence
rend = renderers.DefaultRenderer(
color_proc = cpr,
repo_proc = rpr,
source_sequence = main_seq,
staging_dir = STAGING_DIR,
format = ".png"
)
# rend.set_debug(True)
rend.set_threads(8)
computed_seq = rend.render()
# Compute slate
spr = processors.SlateProcessor(
data = working_data,
width = OUTPUT_WIDTH,
height = OUTPUT_HEIGHT,
staging_dir = STAGING_DIR,
slate_template_path = SLATE_TEMPLATE_PATH,
is_source_linear = False
)
# Render the slate
rend_slate = renderers.DefaultSlateRenderer(
slate_proc = spr,
source_sequence = computed_seq
)
# rend_slate.set_debug(True)
rend_slate.render()