Bases: Extractor
Extracting intermediate videos or sequences with thumbnail for transcoding.
must be run after extract_render_local.py
Source code in client/ayon_nuke/plugins/publish/extract_review_intermediates.py
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160 | class ExtractReviewIntermediates(publish.Extractor):
"""Extracting intermediate videos or sequences with
thumbnail for transcoding.
must be run after extract_render_local.py
"""
order = pyblish.api.ExtractorOrder + 0.01
label = "Extract Review Intermediates"
families = ["review"]
hosts = ["nuke"]
settings_category = "nuke"
# presets
viewer_lut_raw = None
outputs = {}
def process(self, instance):
# TODO 'families' should not be included for filtering of outputs
families = set(instance.data["families"])
# Add product type to families
families.add(instance.data["productType"])
task_type = instance.context.data["taskType"]
product_name = instance.data["productName"]
if "representations" not in instance.data:
instance.data["representations"] = []
# use instance's stagingDir only if explicitly custom
if not instance.data.get("stagingDir_is_custom"):
instance.data["stagingDir"] = os.path.normpath(
os.path.dirname(instance.data["path"]))
self.log.debug(
"StagingDir `{0}`...".format(instance.data["stagingDir"]))
self.log.debug("Outputs: {}".format(self.outputs))
# generate data
with maintained_selection():
generated_repres = []
for o_data in self.outputs:
o_name = o_data["name"]
self.log.debug(
"o_name: {}, o_data: {}".format(o_name, pformat(o_data)))
f_product_types = o_data["filter"]["product_types"]
f_task_types = o_data["filter"]["task_types"]
product_names = o_data["filter"]["product_names"]
self.log.debug(
"f_product_types `{}` > families: {}".format(
f_product_types, families))
self.log.debug(
"f_task_types `{}` > task_type: {}".format(
f_task_types, task_type))
self.log.debug(
"product_names `{}` > product: {}".format(
product_names, product_name))
# test if family found in context
# using intersection to make sure all defined
# families are present in combination
if (
f_product_types
and not families.intersection(f_product_types)
):
continue
# test task types from filter
if f_task_types and task_type not in f_task_types:
continue
# test products from filter
if product_names and not any(
re.search(p, product_name) for p in product_names
):
continue
self.log.debug(
"Baking output `{}` with settings: {}".format(
o_name, o_data)
)
# check if settings have more then one preset
# so we dont need to add outputName to representation
# in case there is only one preset
multiple_presets = len(self.outputs) > 1
# adding bake presets to instance data for other plugins
if not instance.data.get("bakePresets"):
instance.data["bakePresets"] = {}
# add preset to bakePresets
instance.data["bakePresets"][o_name] = o_data
# create exporter instance
exporter = plugin.ExporterReviewMov(
self, instance, o_name, o_data["extension"],
multiple_presets)
delete = not o_data.get("publish", False)
if instance.data.get("farm"):
if "review" in instance.data["families"]:
instance.data["families"].remove("review")
data = exporter.generate_mov(
farm=True, delete=delete, **o_data
)
self.log.debug(
"_ data: {}".format(data))
if not instance.data.get("bakingNukeScripts"):
instance.data["bakingNukeScripts"] = []
instance.data["bakingNukeScripts"].append({
"bakeRenderPath": data.get("bakeRenderPath"),
"bakeScriptPath": data.get("bakeScriptPath"),
"bakeWriteNodeName": data.get("bakeWriteNodeName")
})
else:
data = exporter.generate_mov(delete=delete, **o_data)
# add representation generated by exporter
generated_repres.extend(data["representations"])
self.log.debug(
"__ generated_repres: {}".format(generated_repres))
if generated_repres:
# assign to representations
instance.data["representations"] += generated_repres
instance.data["useSequenceForReview"] = False
else:
instance.data["families"].remove("review")
self.log.debug(
"Removing `review` from families. "
"Not available baking profile."
)
self.log.debug(instance.data["families"])
self.log.debug(
"_ representations: {}".format(
instance.data["representations"]))
|