mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
feat(nuke): extract thumbnail from before Review Data (mov, jpg)
This commit is contained in:
parent
b79e22464b
commit
78f2da25cf
1 changed files with 22 additions and 47 deletions
|
|
@ -4,7 +4,7 @@ from avalon.nuke import lib as anlib
|
||||||
import pyblish.api
|
import pyblish.api
|
||||||
import pype
|
import pype
|
||||||
|
|
||||||
class ExtractReviewData(pype.api.Extractor):
|
class ExtractThumbnail(pype.api.Extractor):
|
||||||
"""Extracts movie and thumbnail with baked in luts
|
"""Extracts movie and thumbnail with baked in luts
|
||||||
|
|
||||||
must be run after extract_render_local.py
|
must be run after extract_render_local.py
|
||||||
|
|
@ -12,7 +12,7 @@ class ExtractReviewData(pype.api.Extractor):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
order = pyblish.api.ExtractorOrder + 0.01
|
order = pyblish.api.ExtractorOrder + 0.01
|
||||||
label = "Extract Review Data"
|
label = "Extract Thumbnail"
|
||||||
|
|
||||||
families = ["review"]
|
families = ["review"]
|
||||||
hosts = ["nuke"]
|
hosts = ["nuke"]
|
||||||
|
|
@ -20,29 +20,19 @@ class ExtractReviewData(pype.api.Extractor):
|
||||||
def process(self, instance):
|
def process(self, instance):
|
||||||
|
|
||||||
with anlib.maintained_selection():
|
with anlib.maintained_selection():
|
||||||
self.log.debug("creating staging dir:")
|
|
||||||
self.staging_dir(instance)
|
|
||||||
|
|
||||||
self.log.debug("instance: {}".format(instance))
|
self.log.debug("instance: {}".format(instance))
|
||||||
self.log.debug("instance.data[families]: {}".format(
|
self.log.debug("instance.data[families]: {}".format(
|
||||||
instance.data["families"]))
|
instance.data["families"]))
|
||||||
|
|
||||||
# if "still" not in instance.data["families"]:
|
self.render_thumbnail(instance)
|
||||||
# self.render_review_representation(instance,
|
|
||||||
# representation="mov")
|
|
||||||
# self.render_review_representation(instance,
|
|
||||||
# representation="jpeg")
|
|
||||||
# else:
|
|
||||||
self.render_review_representation(instance, representation="jpeg")
|
|
||||||
|
|
||||||
|
|
||||||
def render_review_representation(self,
|
def render_thumbnail(self, instance):
|
||||||
instance,
|
|
||||||
representation="mov"):
|
|
||||||
|
|
||||||
assert instance.data['representations'][0]['files'], "Instance data files should't be empty!"
|
assert instance.data['representations'][0]['files'], "Instance data files should't be empty!"
|
||||||
|
|
||||||
temporary_nodes = []
|
temporary_nodes = []
|
||||||
|
self.log.info("Getting staging dir...")
|
||||||
stagingDir = instance.data[
|
stagingDir = instance.data[
|
||||||
'representations'][0]["stagingDir"].replace("\\", "/")
|
'representations'][0]["stagingDir"].replace("\\", "/")
|
||||||
self.log.debug("StagingDir `{0}`...".format(stagingDir))
|
self.log.debug("StagingDir `{0}`...".format(stagingDir))
|
||||||
|
|
@ -107,39 +97,24 @@ class ExtractReviewData(pype.api.Extractor):
|
||||||
|
|
||||||
# create write node
|
# create write node
|
||||||
write_node = nuke.createNode("Write")
|
write_node = nuke.createNode("Write")
|
||||||
|
file = fhead + "jpeg"
|
||||||
|
name = "thumbnail"
|
||||||
|
path = os.path.join(stagingDir, file).replace("\\", "/")
|
||||||
|
instance.data["thumbnail"] = path
|
||||||
|
write_node["file"].setValue(path)
|
||||||
|
write_node["file_type"].setValue("jpeg")
|
||||||
|
write_node["raw"].setValue(1)
|
||||||
|
write_node.setInput(0, previous_node)
|
||||||
|
temporary_nodes.append(write_node)
|
||||||
|
tags = ["thumbnail"]
|
||||||
|
|
||||||
if representation in "mov":
|
# retime for
|
||||||
file = fhead + "baked.mov"
|
first_frame = int(last_frame) / 2
|
||||||
name = "baked"
|
last_frame = int(last_frame) / 2
|
||||||
path = os.path.join(stagingDir, file).replace("\\", "/")
|
|
||||||
self.log.debug("Path: {}".format(path))
|
|
||||||
instance.data["baked_colorspace_movie"] = path
|
|
||||||
write_node["file"].setValue(path)
|
|
||||||
write_node["file_type"].setValue("mov")
|
|
||||||
write_node["raw"].setValue(1)
|
|
||||||
write_node.setInput(0, previous_node)
|
|
||||||
temporary_nodes.append(write_node)
|
|
||||||
tags = ["review", "delete"]
|
|
||||||
|
|
||||||
elif representation in "jpeg":
|
|
||||||
file = fhead + "jpeg"
|
|
||||||
name = "thumbnail"
|
|
||||||
path = os.path.join(stagingDir, file).replace("\\", "/")
|
|
||||||
instance.data["thumbnail"] = path
|
|
||||||
write_node["file"].setValue(path)
|
|
||||||
write_node["file_type"].setValue("jpeg")
|
|
||||||
write_node["raw"].setValue(1)
|
|
||||||
write_node.setInput(0, previous_node)
|
|
||||||
temporary_nodes.append(write_node)
|
|
||||||
tags = ["thumbnail"]
|
|
||||||
|
|
||||||
# retime for
|
|
||||||
first_frame = int(last_frame) / 2
|
|
||||||
last_frame = int(last_frame) / 2
|
|
||||||
|
|
||||||
repre = {
|
repre = {
|
||||||
'name': name,
|
'name': name,
|
||||||
'ext': representation,
|
'ext': "jpeg",
|
||||||
'files': file,
|
'files': file,
|
||||||
"stagingDir": stagingDir,
|
"stagingDir": stagingDir,
|
||||||
"frameStart": first_frame,
|
"frameStart": first_frame,
|
||||||
|
|
@ -154,9 +129,9 @@ class ExtractReviewData(pype.api.Extractor):
|
||||||
|
|
||||||
self.log.debug("representations: {}".format(instance.data["representations"]))
|
self.log.debug("representations: {}".format(instance.data["representations"]))
|
||||||
|
|
||||||
# Clean up
|
# # Clean up
|
||||||
for node in temporary_nodes:
|
# for node in temporary_nodes:
|
||||||
nuke.delete(node)
|
# nuke.delete(node)
|
||||||
|
|
||||||
def get_view_process_node(self):
|
def get_view_process_node(self):
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue