diff --git a/pype/nuke/lib.py b/pype/nuke/lib.py index 36270f37df..23c677cc7f 100644 --- a/pype/nuke/lib.py +++ b/pype/nuke/lib.py @@ -1235,6 +1235,8 @@ class ExporterReview: # get first and last frame self.first_frame = min(self.collection.indexes) self.last_frame = max(self.collection.indexes) + if "slate" in self.instance.data["families"]: + self.first_frame += 1 else: self.fname = os.path.basename(self.path_in) self.fhead = os.path.splitext(self.fname)[0] + "." diff --git a/pype/plugins/global/publish/extract_burnin.py b/pype/plugins/global/publish/extract_burnin.py index a87fd47ea1..dac5c524e7 100644 --- a/pype/plugins/global/publish/extract_burnin.py +++ b/pype/plugins/global/publish/extract_burnin.py @@ -25,11 +25,7 @@ class ExtractBurnin(pype.api.Extractor): if "representations" not in instance.data: raise RuntimeError("Burnin needs already created mov to work on.") - # TODO: expand burnin data list to include all usefull keys - version = '' - if instance.context.data.get('version'): - version = "v" + str(instance.context.data['version']) - + version = instance.context.data.get('version') frame_start = int(instance.data.get("frameStart") or 0) frame_end = int(instance.data.get("frameEnd") or 1) duration = frame_end - frame_start + 1 @@ -42,9 +38,23 @@ class ExtractBurnin(pype.api.Extractor): "frame_end": frame_end, "duration": duration, "version": version, - "comment": instance.context.data.get("comment"), - "intent": instance.context.data.get("intent") + "comment": instance.context.data.get("comment", ""), + "intent": instance.context.data.get("intent", "") } + + # exception for slate workflow + if "slate" in instance.data["families"]: + slate_frame_start = frame_start - 1 + slate_frame_end = frame_end + slate_duration = slate_frame_end - slate_frame_start + 1 + + prep_data.update({ + "slate_frame_start": slate_frame_start, + "slate_frame_end": slate_frame_end, + "slate_duration": slate_duration + }) + + # Update data with template data template_data = instance.data.get("assumedTemplateData") or {} prep_data.update(template_data) diff --git a/pype/plugins/global/publish/integrate_new.py b/pype/plugins/global/publish/integrate_new.py index a15c296b11..8751431223 100644 --- a/pype/plugins/global/publish/integrate_new.py +++ b/pype/plugins/global/publish/integrate_new.py @@ -175,16 +175,6 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): if instance.data.get('version'): next_version = int(instance.data.get('version')) - # self.log.info("Verifying version from assumed destination") - - # assumed_data = instance.data["assumedTemplateData"] - # assumed_version = assumed_data["version"] - # if assumed_version != next_version: - # raise AttributeError("Assumed version 'v{0:03d}' does not match" - # "next version in database " - # "('v{1:03d}')".format(assumed_version, - # next_version)) - self.log.debug("Next version: v{0:03d}".format(next_version)) version_data = self.create_version_data(context, instance) @@ -323,6 +313,10 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): repre.get("frameEnd"))) index_frame_start = int(repre.get("frameStart")) + # exception for slate workflow + if "slate" in instance.data["families"]: + index_frame_start -= 1 + dst_padding_exp = src_padding_exp dst_start_frame = None for i in src_collection.indexes: @@ -461,20 +455,16 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): self.hardlink_file(src, dest) def unc_convert(self, path): - self.log.debug("_ path .. `{}`".format(path)) drive, _path = os.path.splitdrive(path) - self.log.debug("_ drive, _path .. `{}`, `{}`".format(drive, _path)) unc = Path(drive).resolve() - self.log.debug("_ unc.resolved .. `{}`".format(unc)) path = str(unc) + _path - self.log.debug("_ path.resolved .. `{}`".format(path)) if not os.path.exists(str(unc)): - self.log.info("_ converting to unc from environments ..") + self.log.info("Converting to unc from environments ..") + path_replace = os.getenv("PYPE_STUDIO_PROJECTS_PATH") path_mount = os.getenv("PYPE_STUDIO_PROJECTS_MOUNT") - self.log.debug("_ path_replace .. `{}`".format(path_replace)) - self.log.debug("_ path_mount .. `{}`".format(path_mount)) + if "/" in path_mount: path = path.replace(path_mount[0:-1], path_replace) else: diff --git a/pype/plugins/global/publish/submit_publish_job.py b/pype/plugins/global/publish/submit_publish_job.py index 49ae958cd1..0d4018d46f 100644 --- a/pype/plugins/global/publish/submit_publish_job.py +++ b/pype/plugins/global/publish/submit_publish_job.py @@ -321,6 +321,8 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): "source": source, "user": context.data["user"], "version": context.data["version"], + "intent": context.data["intent"], + "comment": context.data["comment"], # Optional metadata (for debugging) "metadata": { "instance": data, diff --git a/pype/plugins/nuke/publish/collect_script_version.py b/pype/plugins/nuke/publish/collect_script_version.py new file mode 100644 index 0000000000..9a6b5bf572 --- /dev/null +++ b/pype/plugins/nuke/publish/collect_script_version.py @@ -0,0 +1,22 @@ +import os +import pype.api as pype +import pyblish.api + + +class CollectScriptVersion(pyblish. api.ContextPlugin): + """Collect Script Version.""" + + order = pyblish.api.CollectorOrder + label = "Collect Script Version" + hosts = [ + "nuke", + "nukeassist" + ] + + def process(self, context): + file_path = context.data["currentFile"] + base_name = os.path.basename(file_path) + # get version string + version = pype.get_version_from_path(base_name) + + context.data['version'] = version diff --git a/pype/plugins/nuke/publish/collect_workfile.py b/pype/plugins/nuke/publish/collect_workfile.py index aaee554fbf..4fff9f46ed 100644 --- a/pype/plugins/nuke/publish/collect_workfile.py +++ b/pype/plugins/nuke/publish/collect_workfile.py @@ -2,8 +2,6 @@ import nuke import pyblish.api import os -import pype.api as pype - from avalon.nuke import ( get_avalon_knob_data, add_publish_knob @@ -11,7 +9,7 @@ from avalon.nuke import ( class CollectWorkfile(pyblish.api.ContextPlugin): - """Publish current script version.""" + """Collect current script for publish.""" order = pyblish.api.CollectorOrder + 0.1 label = "Collect Workfile" @@ -31,9 +29,6 @@ class CollectWorkfile(pyblish.api.ContextPlugin): base_name = os.path.basename(file_path) subset = "{0}_{1}".format(os.getenv("AVALON_TASK", None), family) - # get version string - version = pype.get_version_from_path(base_name) - # Get frame range first_frame = int(root["first_frame"].getValue()) last_frame = int(root["last_frame"].getValue()) @@ -53,7 +48,6 @@ class CollectWorkfile(pyblish.api.ContextPlugin): script_data = { "asset": os.getenv("AVALON_ASSET", None), - "version": version, "frameStart": first_frame + handle_start, "frameEnd": last_frame - handle_end, "resolutionWidth": resolution_width, diff --git a/pype/plugins/nuke/publish/collect_writes.py b/pype/plugins/nuke/publish/collect_writes.py index ff315a12ea..37c86978b6 100644 --- a/pype/plugins/nuke/publish/collect_writes.py +++ b/pype/plugins/nuke/publish/collect_writes.py @@ -50,9 +50,10 @@ class CollectNukeWrites(pyblish.api.InstancePlugin): output_dir = os.path.dirname(path) self.log.debug('output dir: {}'.format(output_dir)) - # get version - version = pype.get_version_from_path(nuke.root().name()) - instance.data['version'] = version + # get version to instance for integration + instance.data['version'] = instance.context.data.get( + "version", pype.get_version_from_path(nuke.root().name())) + self.log.debug('Write Version: %s' % instance.data('version')) # create label @@ -94,7 +95,7 @@ class CollectNukeWrites(pyblish.api.InstancePlugin): "handleEnd": handle_end, "frameStart": first_frame + handle_start, "frameEnd": last_frame - handle_end, - "version": int(version), + "version": int(instance.data['version']), "colorspace": node["colorspace"].value(), "families": [instance.data["family"]], "subset": instance.data["subset"], diff --git a/pype/plugins/nuke/publish/extract_render_local.py b/pype/plugins/nuke/publish/extract_render_local.py index 825db67e9d..9b8baa468b 100644 --- a/pype/plugins/nuke/publish/extract_render_local.py +++ b/pype/plugins/nuke/publish/extract_render_local.py @@ -28,6 +28,11 @@ class NukeRenderLocal(pype.api.Extractor): self.log.debug("instance collected: {}".format(instance.data)) first_frame = instance.data.get("frameStart", None) + + # exception for slate workflow + if "slate" in instance.data["families"]: + first_frame -= 1 + last_frame = instance.data.get("frameEnd", None) node_subset_name = instance.data.get("name", None) @@ -47,6 +52,10 @@ class NukeRenderLocal(pype.api.Extractor): int(last_frame) ) + # exception for slate workflow + if "slate" in instance.data["families"]: + first_frame += 1 + path = node['file'].value() out_dir = os.path.dirname(path) ext = node["file_type"].value() diff --git a/pype/plugins/nuke/publish/extract_slate_frame.py b/pype/plugins/nuke/publish/extract_slate_frame.py index a0f1c06828..fd1523447a 100644 --- a/pype/plugins/nuke/publish/extract_slate_frame.py +++ b/pype/plugins/nuke/publish/extract_slate_frame.py @@ -60,6 +60,10 @@ class ExtractSlateFrame(pype.api.Extractor): # get first and last frame first_frame = min(collection.indexes) - 1 + + if "slate" in instance.data["families"]: + first_frame += 1 + last_frame = first_frame else: fname = os.path.basename(instance.data.get("path", None)) diff --git a/pype/plugins/nuke/publish/submit_nuke_deadline.py b/pype/plugins/nuke/publish/submit_nuke_deadline.py index d9207d2bfc..580a114562 100644 --- a/pype/plugins/nuke/publish/submit_nuke_deadline.py +++ b/pype/plugins/nuke/publish/submit_nuke_deadline.py @@ -1,7 +1,7 @@ import os import json import getpass - + from avalon import api from avalon.vendor import requests import re @@ -43,6 +43,12 @@ class NukeSubmitDeadline(pyblish.api.InstancePlugin): render_path = instance.data['path'] render_dir = os.path.normpath(os.path.dirname(render_path)) + # frame start definition + frame_start = int(instance.data["frameStart"]) + # exception for slate workflow + if "slate" in instance.data["families"]: + frame_start -= 1 + script_path = context.data["currentFile"] script_name = os.path.basename(script_path) @@ -75,7 +81,7 @@ class NukeSubmitDeadline(pyblish.api.InstancePlugin): "Plugin": "Nuke", "Frames": "{start}-{end}".format( - start=int(instance.data["frameStart"]), + start=frame_start, end=int(instance.data["frameEnd"]) ), "ChunkSize": instance.data["deadlineChunkSize"], diff --git a/pype/plugins/nuke/publish/validate_rendered_frames.py b/pype/plugins/nuke/publish/validate_rendered_frames.py index 3887b5d5b7..c63c289947 100644 --- a/pype/plugins/nuke/publish/validate_rendered_frames.py +++ b/pype/plugins/nuke/publish/validate_rendered_frames.py @@ -75,6 +75,9 @@ class ValidateRenderedFrames(pyblish.api.InstancePlugin): self.log.info( 'len(collection.indexes): {}'.format(collected_frames_len) ) + + if "slate" in instance.data["families"]: + collected_frames_len -= 1 assert (collected_frames_len == frame_length), ( "{} missing frames. Use repair to render all frames"