Merged in hotfix/validate_ftrack_attributes (pull request #353)

Hotfix/validate ftrack attributes

Approved-by: Milan Kolar <milan@orbi.tools>
This commit is contained in:
Jakub Ježek 2019-11-05 10:12:32 +00:00 committed by Milan Kolar
commit 2cb1c7efe3
7 changed files with 32 additions and 10 deletions

View file

@ -379,6 +379,10 @@ def add_rendering_knobs(node):
knob = nuke.Boolean_Knob("render_farm", "Render on Farm") knob = nuke.Boolean_Knob("render_farm", "Render on Farm")
knob.setValue(False) knob.setValue(False)
node.addKnob(knob) node.addKnob(knob)
if "review" not in node.knobs():
knob = nuke.Boolean_Knob("review", "Review")
knob.setValue(True)
node.addKnob(knob)
return node return node

View file

@ -46,7 +46,8 @@ class ValidateFtrackAttributes(pyblish.api.InstancePlugin):
"Missing FTrack Task entity in context") "Missing FTrack Task entity in context")
host = pyblish.api.current_host() host = pyblish.api.current_host()
to_check = context.data["presets"][host].get("ftrack_attributes") to_check = context.data["presets"].get(
host, {}).get("ftrack_attributes")
if not to_check: if not to_check:
self.log.warning("ftrack_attributes preset not found") self.log.warning("ftrack_attributes preset not found")
return return

View file

@ -110,6 +110,7 @@ class LoadSequence(api.Loader):
last += self.handle_end last += self.handle_end
file = self.fname.replace("\\", "/") file = self.fname.replace("\\", "/")
log.info("file: {}\n".format(self.fname)) log.info("file: {}\n".format(self.fname))
repr_cont = context["representation"]["context"] repr_cont = context["representation"]["context"]
@ -118,6 +119,11 @@ class LoadSequence(api.Loader):
repr_cont["subset"], repr_cont["subset"],
repr_cont["representation"]) repr_cont["representation"])
if "#" not in file:
frame = repr_cont.get("frame")
padding = len(frame)
file = file.replace(frame, "#"*padding)
# Create the Loader with the filename path set # Create the Loader with the filename path set
with viewer_update_and_undo_stop(): with viewer_update_and_undo_stop():
# TODO: it might be universal read to img/geo/camera # TODO: it might be universal read to img/geo/camera

View file

@ -1,5 +1,5 @@
import pyblish.api import pyblish.api
import nuke
class CollectReview(pyblish.api.InstancePlugin): class CollectReview(pyblish.api.InstancePlugin):
"""Collect review instance from rendered frames """Collect review instance from rendered frames
@ -9,9 +9,20 @@ class CollectReview(pyblish.api.InstancePlugin):
family = "review" family = "review"
label = "Collect Review" label = "Collect Review"
hosts = ["nuke"] hosts = ["nuke"]
families = ["render", "render.local"] families = ["render", "render.local", "render.farm"]
def process(self, instance): def process(self, instance):
if instance.data["families"]:
instance.data["families"].append("review") node = instance[0]
self.log.info("Review collected: `{}`".format(instance))
if "review" not in node.knobs():
knob = nuke.Boolean_Knob("review", "Review")
knob.setValue(True)
node.addKnob(knob)
if not node["review"].value():
return
instance.data["families"].append("review")
instance.data['families'].append('ftrack')
self.log.info("Review collected: `{}`".format(instance))

View file

@ -65,7 +65,6 @@ class CollectNukeWrites(pyblish.api.InstancePlugin):
) )
if 'render' in instance.data['families']: if 'render' in instance.data['families']:
instance.data['families'].append('ftrack')
if "representations" not in instance.data: if "representations" not in instance.data:
instance.data["representations"] = list() instance.data["representations"] = list()
@ -78,15 +77,15 @@ class CollectNukeWrites(pyblish.api.InstancePlugin):
try: try:
collected_frames = os.listdir(output_dir) collected_frames = os.listdir(output_dir)
if collected_frames:
representation['frameStart'] = "%0{}d".format(
len(str(last_frame))) % first_frame
representation['files'] = collected_frames representation['files'] = collected_frames
instance.data["representations"].append(representation) instance.data["representations"].append(representation)
except Exception: except Exception:
instance.data["representations"].append(representation) instance.data["representations"].append(representation)
self.log.debug("couldn't collect frames: {}".format(label)) self.log.debug("couldn't collect frames: {}".format(label))
if 'render.local' in instance.data['families']:
instance.data['families'].append('ftrack')
# Add version data to instance # Add version data to instance
version_data = { version_data = {
"handles": handle_start, "handles": handle_start,

View file

@ -58,6 +58,7 @@ class NukeRenderLocal(pype.api.Extractor):
repre = { repre = {
'name': ext, 'name': ext,
'ext': ext, 'ext': ext,
'frameStart': "%0{}d".format(len(str(last_frame))) % first_frame,
'files': collected_frames, 'files': collected_frames,
"stagingDir": out_dir, "stagingDir": out_dir,
"anatomy_template": "render" "anatomy_template": "render"