From 5fe6854f87ec17e33b860595572ae8796554d78a Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Fri, 28 Feb 2020 12:26:25 +0100 Subject: [PATCH 01/16] fix(nk): adding new compatibility code submition from nuke to deadline --- .../nuke/publish/submit_nuke_deadline.py | 65 ++++++++++++++++++- 1 file changed, 63 insertions(+), 2 deletions(-) diff --git a/pype/plugins/nuke/publish/submit_nuke_deadline.py b/pype/plugins/nuke/publish/submit_nuke_deadline.py index 71108189c0..d69d5ba8bc 100644 --- a/pype/plugins/nuke/publish/submit_nuke_deadline.py +++ b/pype/plugins/nuke/publish/submit_nuke_deadline.py @@ -5,7 +5,6 @@ import getpass from avalon import api from avalon.vendor import requests import re - import pyblish.api @@ -55,7 +54,9 @@ class NukeSubmitDeadline(pyblish.api.InstancePlugin): ) # Store output dir for unified publisher (filesequence) instance.data["deadlineSubmissionJob"] = response.json() - instance.data["publishJobState"] = "Active" + instance.data["outputDir"] = os.path.dirname( + render_path).replace("\\", "/") + instance.data["publishJobState"] = "Suspended" if instance.data.get("bakeScriptPath"): render_path = instance.data.get("bakeRenderPath") @@ -87,6 +88,9 @@ class NukeSubmitDeadline(pyblish.api.InstancePlugin): script_name = os.path.basename(script_path) jobname = "%s - %s" % (script_name, instance.name) + output_filename_0 = self.preview_fname(render_path) + output_directory_0 = render_dir.replace("\\", "/") + if not responce_data: responce_data = {} @@ -119,6 +123,11 @@ class NukeSubmitDeadline(pyblish.api.InstancePlugin): ), "Comment": self._comment, + # Optional, enable double-click to preview rendered + # frames from Deadline Monitor + "OutputFilename0": output_filename_0.replace("\\", "/"), + "OutputDirectory0": output_directory_0 + }, "PluginInfo": { # Input @@ -220,6 +229,10 @@ class NukeSubmitDeadline(pyblish.api.InstancePlugin): self.log.info("Submitting..") self.log.info(json.dumps(payload, indent=4, sort_keys=True)) + # adding expectied files to instance.data + self.expected_files(instance, render_path) + self.log.debug("__ expectedFiles: `{}`".format( + instance.data["expectedFiles"])) response = requests.post(self.deadline_url, json=payload) if not response.ok: @@ -240,3 +253,51 @@ class NukeSubmitDeadline(pyblish.api.InstancePlugin): "%f=%d was rounded off to nearest integer" % (value, int(value)) ) + + def preview_fname(self, path): + """Return output file path with #### for padding. + + Deadline requires the path to be formatted with # in place of numbers. + For example `/path/to/render.####.png` + + Args: + path (str): path to rendered images + + Returns: + str + + """ + self.log.debug("_ path: `{}`".format(path)) + if "%" in path: + search_results = re.search(r"(%0)(\d)(d.)", path).groups() + self.log.debug("_ search_results: `{}`".format(search_results)) + return int(search_results[1]) + if "#" in path: + self.log.debug("_ path: `{}`".format(path)) + return path + else: + return path + + def expected_files(self, + instance, + path): + """ Create expected files in instance data + """ + if not instance.data.get("expectedFiles"): + instance.data["expectedFiles"] = list() + + dir = os.path.dirname(path) + file = os.path.basename(path) + + if "#" in file: + pparts = file.split("#") + padding = "%0{}d".format(len(pparts) - 1) + file = pparts[0] + padding + pparts[-1] + + if "%" not in file: + instance.data["expectedFiles"].append(path) + return + + for i in range(self._frame_start, (self._frame_end + 1)): + instance.data["expectedFiles"].append( + os.path.join(dir, (file % i)).replace("\\", "/")) From 408db0e8600e7e70d469c6103e96a3e27f9d8242 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Fri, 28 Feb 2020 12:27:06 +0100 Subject: [PATCH 02/16] fix(nk): activating back version passing to instance --- pype/plugins/nuke/publish/collect_writes.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/pype/plugins/nuke/publish/collect_writes.py b/pype/plugins/nuke/publish/collect_writes.py index c29f676ef7..3882ed0b32 100644 --- a/pype/plugins/nuke/publish/collect_writes.py +++ b/pype/plugins/nuke/publish/collect_writes.py @@ -52,9 +52,8 @@ class CollectNukeWrites(pyblish.api.InstancePlugin): output_dir = os.path.dirname(path) self.log.debug('output dir: {}'.format(output_dir)) - # # get version to instance for integration - # instance.data['version'] = instance.context.data.get( - # "version", pype.get_version_from_path(nuke.root().name())) + # get version to instance for integration + instance.data['version'] = instance.context.data["version"] self.log.debug('Write Version: %s' % instance.data('version')) From 682bb996abe3428511b5a362a6fad1f39c9378ae Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Fri, 28 Feb 2020 12:27:40 +0100 Subject: [PATCH 03/16] fix(global): adding 2d compatibility --- .../global/publish/submit_publish_job.py | 55 ++++++++++++------- 1 file changed, 34 insertions(+), 21 deletions(-) diff --git a/pype/plugins/global/publish/submit_publish_job.py b/pype/plugins/global/publish/submit_publish_job.py index 29dce58101..e4151d2317 100644 --- a/pype/plugins/global/publish/submit_publish_job.py +++ b/pype/plugins/global/publish/submit_publish_job.py @@ -131,6 +131,8 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): - publishJobState (str, Optional): "Active" or "Suspended" This defaults to "Suspended" + - expectedFiles (list or dict): explained bellow + """ label = "Submit image sequence jobs to Deadline or Muster" @@ -166,7 +168,8 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): instance_transfer = { "slate": ["slateFrame"], "review": ["lutPath"], - "render.farm": ["bakeScriptPath", "bakeRenderPath", "bakeWriteNodeName"] + "render.farm": ["bakeScriptPath", "bakeRenderPath", + "bakeWriteNodeName", "version"] } # list of family names to transfer to new family if present @@ -384,13 +387,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): "tags": ["review"] if preview else [] } - # add tags - if preview: - if "ftrack" not in new_instance["families"]: - if os.environ.get("FTRACK_SERVER"): - new_instance["families"].append("ftrack") - if "review" not in new_instance["families"]: - new_instance["families"].append("review") + self._solve_families(new_instance, preview) new_instance["representations"] = [rep] @@ -399,6 +396,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): if new_instance.get("extendFrames", False): self._copy_extend_frames(new_instance, rep) instances.append(new_instance) + return instances def _get_representations(self, instance, exp_files): @@ -419,6 +417,8 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): start = int(instance.get("frameStart")) end = int(instance.get("frameEnd")) cols, rem = clique.assemble(exp_files) + bake_render_path = instance.get("bakeRenderPath") + # create representation for every collected sequence for c in cols: ext = c.tail.lstrip(".") @@ -435,8 +435,12 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): preview = True break break + + if bake_render_path: + preview = False + rep = { - "name": str(c), + "name": ext, "ext": ext, "files": [os.path.basename(f) for f in list(c)], "frameStart": start, @@ -450,32 +454,41 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): representations.append(rep) - families = instance.get("families") - # if we have one representation with preview tag - # flag whole instance for review and for ftrack - if preview: - if "ftrack" not in families: - if os.environ.get("FTRACK_SERVER"): - families.append("ftrack") - if "review" not in families: - families.append("review") - instance["families"] = families + self._solve_families(instance, preview) # add reminders as representations for r in rem: ext = r.split(".")[-1] rep = { - "name": r, + "name": ext, "ext": ext, "files": os.path.basename(r), "stagingDir": os.path.dirname(r), "anatomy_template": "publish", } - + if r in bake_render_path: + rep.update({ + "anatomy_template": "render", + "tags": ["review", "preview"] + }) + # solve families with `preview` attributes + self._solve_families(instance, True) representations.append(rep) return representations + def _solve_families(self, instance, preview=False): + families = instance.get("families") + # if we have one representation with preview tag + # flag whole instance for review and for ftrack + if preview: + if "ftrack" not in families: + if os.environ.get("FTRACK_SERVER"): + families.append("ftrack") + if "review" not in families: + families.append("review") + instance["families"] = families + def process(self, instance): """ Detect type of renderfarm submission and create and post dependend job From 833ba22ecfc101b8e14250f125d914e4a3ae0147 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Fri, 28 Feb 2020 12:28:02 +0100 Subject: [PATCH 04/16] fix(global): failing due missing tag in representation --- pype/plugins/global/publish/extract_jpeg.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pype/plugins/global/publish/extract_jpeg.py b/pype/plugins/global/publish/extract_jpeg.py index 0b0e839529..9ad6a15dfe 100644 --- a/pype/plugins/global/publish/extract_jpeg.py +++ b/pype/plugins/global/publish/extract_jpeg.py @@ -27,8 +27,9 @@ class ExtractJpegEXR(pyblish.api.InstancePlugin): representations_new = representations[:] for repre in representations: + tags = repre.get("tags", []) self.log.debug(repre) - valid = 'review' in repre['tags'] or "thumb-nuke" in repre['tags'] + valid = 'review' in tags or "thumb-nuke" in tags if not valid: continue From 295208279f86fad583b211143329c1e47df489eb Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Fri, 28 Feb 2020 12:28:26 +0100 Subject: [PATCH 05/16] fix(global): version should be number --- pype/plugins/global/publish/collect_scene_version.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pype/plugins/global/publish/collect_scene_version.py b/pype/plugins/global/publish/collect_scene_version.py index 2844a695e2..02e913199b 100644 --- a/pype/plugins/global/publish/collect_scene_version.py +++ b/pype/plugins/global/publish/collect_scene_version.py @@ -21,7 +21,7 @@ class CollectSceneVersion(pyblish.api.ContextPlugin): if '' in filename: return - rootVersion = pype.get_version_from_path(filename) + rootVersion = int(pype.get_version_from_path(filename)) context.data['version'] = rootVersion - + self.log.info("{}".format(type(rootVersion))) self.log.info('Scene Version: %s' % context.data.get('version')) From 1944cbdd72fbf1f5699ac7e7a0be9ed163a04765 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Fri, 28 Feb 2020 16:43:31 +0100 Subject: [PATCH 06/16] action set attribute `is_published` of deleted asset versions to False --- .../actions/action_delete_old_versions.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/pype/ftrack/actions/action_delete_old_versions.py b/pype/ftrack/actions/action_delete_old_versions.py index bec21dae96..23ceb124e5 100644 --- a/pype/ftrack/actions/action_delete_old_versions.py +++ b/pype/ftrack/actions/action_delete_old_versions.py @@ -361,6 +361,24 @@ class DeleteOldVersions(BaseAction): self.dbcon.uninstall() + for entity in entities: + entity["is_published"] = False + + try: + session.commit() + + except Exception: + msg = ( + "Could not set `is_published` attribute to `False`" + " for selected AssetVersions." + ) + self.log.warning(msg, exc_info=True) + + return { + "success": False, + "message": msg + } + return True def delete_whole_dir_paths(self, dir_paths): From 3fba3e17ad44a6394419aca019ce67781fc590c0 Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Fri, 28 Feb 2020 16:45:15 +0100 Subject: [PATCH 07/16] just commenting because last commit won't work --- .../actions/action_delete_old_versions.py | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/pype/ftrack/actions/action_delete_old_versions.py b/pype/ftrack/actions/action_delete_old_versions.py index 23ceb124e5..7b8b7c5617 100644 --- a/pype/ftrack/actions/action_delete_old_versions.py +++ b/pype/ftrack/actions/action_delete_old_versions.py @@ -361,23 +361,23 @@ class DeleteOldVersions(BaseAction): self.dbcon.uninstall() - for entity in entities: - entity["is_published"] = False - - try: - session.commit() - - except Exception: - msg = ( - "Could not set `is_published` attribute to `False`" - " for selected AssetVersions." - ) - self.log.warning(msg, exc_info=True) - - return { - "success": False, - "message": msg - } + # for entity in entities: + # entity["is_published"] = False + # + # try: + # session.commit() + # + # except Exception: + # msg = ( + # "Could not set `is_published` attribute to `False`" + # " for selected AssetVersions." + # ) + # self.log.warning(msg, exc_info=True) + # + # return { + # "success": False, + # "message": msg + # } return True From f63ec18f4eb677d1e06a9a91b325dd4a811e0fde Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Fri, 28 Feb 2020 17:11:07 +0100 Subject: [PATCH 08/16] first attemp possible solution --- .../actions/action_delete_old_versions.py | 74 +++++++++++++------ 1 file changed, 53 insertions(+), 21 deletions(-) diff --git a/pype/ftrack/actions/action_delete_old_versions.py b/pype/ftrack/actions/action_delete_old_versions.py index 7b8b7c5617..f6a66318c9 100644 --- a/pype/ftrack/actions/action_delete_old_versions.py +++ b/pype/ftrack/actions/action_delete_old_versions.py @@ -167,8 +167,11 @@ class DeleteOldVersions(BaseAction): asset_versions_by_parent_id = collections.defaultdict(list) subset_names_by_asset_name = collections.defaultdict(list) + ftrack_assets_by_name = {} for entity in entities: - parent_ent = entity["asset"]["parent"] + ftrack_asset = entity["asset"] + + parent_ent = ftrack_asset["parent"] parent_ftrack_id = parent_ent["id"] parent_name = parent_ent["name"] @@ -183,9 +186,12 @@ class DeleteOldVersions(BaseAction): project = parent_ent["project"] # Collect subset names per asset - subset_name = entity["asset"]["name"] + subset_name = ftrack_asset["name"] subset_names_by_asset_name[parent_name].append(subset_name) + if subset_name not in ftrack_assets_by_name: + ftrack_assets_by_name[subset_name] = ftrack_asset + # Set Mongo collection project_name = project["full_name"] self.dbcon.Session["AVALON_PROJECT"] = project_name @@ -236,7 +242,6 @@ class DeleteOldVersions(BaseAction): def sort_func(ent): return int(ent["name"]) - last_versions_by_parent = collections.defaultdict(list) all_last_versions = [] for parent_id, _versions in versions_by_parent.items(): for idx, version in enumerate( @@ -244,7 +249,6 @@ class DeleteOldVersions(BaseAction): ): if idx >= versions_count: break - last_versions_by_parent[parent_id].append(version) all_last_versions.append(version) self.log.debug("Collected versions ({})".format(len(versions))) @@ -253,6 +257,11 @@ class DeleteOldVersions(BaseAction): for version in all_last_versions: versions.remove(version) + # Update versions_by_parent without filtered versions + versions_by_parent = collections.defaultdict(list) + for ent in versions: + versions_by_parent[ent["parent"]].append(ent) + # Filter already deleted versions versions_to_pop = [] for version in versions: @@ -361,23 +370,46 @@ class DeleteOldVersions(BaseAction): self.dbcon.uninstall() - # for entity in entities: - # entity["is_published"] = False - # - # try: - # session.commit() - # - # except Exception: - # msg = ( - # "Could not set `is_published` attribute to `False`" - # " for selected AssetVersions." - # ) - # self.log.warning(msg, exc_info=True) - # - # return { - # "success": False, - # "message": msg - # } + # Set attribute `is_published` to `False` on ftrack AssetVersions + for subset_id, _versions in versions_by_parent.items(): + subset_name = None + for subset in subsets: + if subset["_id"] == subset_id: + subset_name = subset["name"] + break + + if subset_name is None: + self.log.warning( + "Subset with ID `{}` was not found.".format(str(subset_id)) + ) + continue + + ftrack_asset = ftrack_assets_by_name.get(subset_name) + if not ftrack_asset: + self.log.warning(( + "Could not find Ftrack asset with name `{}`" + ).format(subset_name)) + continue + + version_numbers = [int(ver["name"]) for ver in _versions] + for version in ftrack_asset["versions"]: + if int(version["version"]) in version_numbers: + version["is_published"] = False + + try: + session.commit() + + except Exception: + msg = ( + "Could not set `is_published` attribute to `False`" + " for selected AssetVersions." + ) + self.log.warning(msg, exc_info=True) + + return { + "success": False, + "message": msg + } return True From 3a3774c3baa58da245011d52ede69f5935519767 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Fri, 28 Feb 2020 17:31:27 +0100 Subject: [PATCH 09/16] fix(nuke): thumbnail to publish on farm --- pype/plugins/nuke/publish/extract_thumbnail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pype/plugins/nuke/publish/extract_thumbnail.py b/pype/plugins/nuke/publish/extract_thumbnail.py index 55ba34a0d4..88ea78e623 100644 --- a/pype/plugins/nuke/publish/extract_thumbnail.py +++ b/pype/plugins/nuke/publish/extract_thumbnail.py @@ -116,7 +116,7 @@ class ExtractThumbnail(pype.api.Extractor): write_node["raw"].setValue(1) write_node.setInput(0, previous_node) temporary_nodes.append(write_node) - tags = ["thumbnail"] + tags = ["thumbnail", "publish_on_farm"] # retime for first_frame = int(last_frame) / 2 From 6f545cec66e7c60a60b8a5a9d0d415d6bc69b2d2 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Fri, 28 Feb 2020 17:42:14 +0100 Subject: [PATCH 10/16] fix(nk): adding handles to instance data --- pype/plugins/nuke/publish/collect_writes.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pype/plugins/nuke/publish/collect_writes.py b/pype/plugins/nuke/publish/collect_writes.py index 3882ed0b32..76c2e8fa75 100644 --- a/pype/plugins/nuke/publish/collect_writes.py +++ b/pype/plugins/nuke/publish/collect_writes.py @@ -111,7 +111,8 @@ class CollectNukeWrites(pyblish.api.InstancePlugin): "outputDir": output_dir, "ext": ext, "label": label, - "handles": handles, + "handleStart": handle_start, + "handleEnd": handle_end, "frameStart": first_frame, "frameEnd": last_frame, "outputType": output_type, From d9f08df58918295abc7d63e91a3b287c0e7a888b Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Fri, 28 Feb 2020 17:42:41 +0100 Subject: [PATCH 11/16] fix(nk): removing obsolete plugin --- .../nuke/publish/collect_script_version.py | 22 ------------------- 1 file changed, 22 deletions(-) delete mode 100644 pype/plugins/nuke/publish/collect_script_version.py diff --git a/pype/plugins/nuke/publish/collect_script_version.py b/pype/plugins/nuke/publish/collect_script_version.py deleted file mode 100644 index 9a6b5bf572..0000000000 --- a/pype/plugins/nuke/publish/collect_script_version.py +++ /dev/null @@ -1,22 +0,0 @@ -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 From 391861da419d112df89eb8cd99a9a15ee40aa712 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Fri, 28 Feb 2020 17:43:22 +0100 Subject: [PATCH 12/16] fix(global): improving representation submition --- .../global/publish/submit_publish_job.py | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/pype/plugins/global/publish/submit_publish_job.py b/pype/plugins/global/publish/submit_publish_job.py index e4151d2317..80b3137673 100644 --- a/pype/plugins/global/publish/submit_publish_job.py +++ b/pype/plugins/global/publish/submit_publish_job.py @@ -468,8 +468,9 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): } if r in bake_render_path: rep.update({ + "fps": instance.get("fps"), "anatomy_template": "render", - "tags": ["review", "preview"] + "tags": ["review", "delete"] }) # solve families with `preview` attributes self._solve_families(instance, True) @@ -498,7 +499,6 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): :param instance: Instance data :type instance: dict """ - data = instance.data.copy() context = instance.context self.context = context @@ -531,10 +531,19 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): start = instance.data.get("frameStart") if start is None: start = context.data["frameStart"] + end = instance.data.get("frameEnd") if end is None: end = context.data["frameEnd"] + handle_start = instance.data.get("handleStart") + if handle_start is None: + handle_start = context.data["handleStart"] + + handle_end = instance.data.get("handleEnd") + if handle_end is None: + handle_end = context.data["handleEnd"] + if data.get("extendFrames", False): start, end = self._extend_frames( asset, @@ -563,7 +572,9 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): "asset": asset, "frameStart": start, "frameEnd": end, - "fps": data.get("fps", 25), + "handleStart": handle_start, + "handleEnd": handle_end, + "fps": data["fps"], "source": source, "extendFrames": data.get("extendFrames"), "overrideExistingFrame": data.get("overrideExistingFrame"), @@ -584,6 +595,16 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): for v in values: instance_skeleton_data[v] = instance.data.get(v) + # look into instance data if representations are not having any + # which are having tag `publish_on_farm` and include them + for r in instance.data.get("representations", []): + if "publish_on_farm" in r.get("tags"): + # create representations attribute of not there + if "representations" not in instance_skeleton_data.keys(): + instance_skeleton_data["representations"] = [] + + instance_skeleton_data["representations"].append(r) + instances = None assert data.get("expectedFiles"), ("Submission from old Pype version" " - missing expectedFiles") @@ -657,7 +678,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): data.get("expectedFiles") ) - if "representations" not in instance_skeleton_data: + if "representations" not in instance_skeleton_data.keys(): instance_skeleton_data["representations"] = [] # add representation From 81662d4edd50dd9a40965236ff186c25cee6c2ef Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Fri, 28 Feb 2020 17:43:41 +0100 Subject: [PATCH 13/16] fix(nuke): improving loaders --- pype/plugins/nuke/load/load_mov.py | 10 +++++++--- pype/plugins/nuke/load/load_sequence.py | 5 ++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/pype/plugins/nuke/load/load_mov.py b/pype/plugins/nuke/load/load_mov.py index 77346a82a4..88e65156cb 100644 --- a/pype/plugins/nuke/load/load_mov.py +++ b/pype/plugins/nuke/load/load_mov.py @@ -112,6 +112,7 @@ class LoadMov(api.Loader): ) version = context['version'] version_data = version.get("data", {}) + repr_id = context["representation"]["_id"] orig_first = version_data.get("frameStart") orig_last = version_data.get("frameEnd") @@ -120,12 +121,16 @@ class LoadMov(api.Loader): first = orig_first - diff last = orig_last - diff - handle_start = version_data.get("handleStart") - handle_end = version_data.get("handleEnd") + handle_start = version_data.get("handleStart", 0) + handle_end = version_data.get("handleEnd", 0) colorspace = version_data.get("colorspace") repr_cont = context["representation"]["context"] + self.log.debug( + "Representation id `{}` ".format(repr_id)) + + context["representation"]["_id"] # create handles offset (only to last, because of mov) last += handle_start + handle_end # offset should be with handles so it match orig frame range @@ -138,7 +143,6 @@ class LoadMov(api.Loader): file = self.fname if not file: - repr_id = context["representation"]["_id"] self.log.warning( "Representation id `{}` is failing to load".format(repr_id)) return diff --git a/pype/plugins/nuke/load/load_sequence.py b/pype/plugins/nuke/load/load_sequence.py index db77c53aff..690f074c3f 100644 --- a/pype/plugins/nuke/load/load_sequence.py +++ b/pype/plugins/nuke/load/load_sequence.py @@ -86,8 +86,11 @@ class LoadSequence(api.Loader): version = context['version'] version_data = version.get("data", {}) - + repr_id = context["representation"]["_id"] + self.log.info("version_data: {}\n".format(version_data)) + self.log.debug( + "Representation id `{}` ".format(repr_id)) self.first_frame = int(nuke.root()["first_frame"].getValue()) self.handle_start = version_data.get("handleStart", 0) From ce03cacd8b5fcf6976071b46218986179123adef Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Mon, 2 Mar 2020 22:37:34 +0100 Subject: [PATCH 14/16] remove useless outputDirectory0 --- pype/plugins/nuke/publish/submit_nuke_deadline.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pype/plugins/nuke/publish/submit_nuke_deadline.py b/pype/plugins/nuke/publish/submit_nuke_deadline.py index d69d5ba8bc..ba43ed574b 100644 --- a/pype/plugins/nuke/publish/submit_nuke_deadline.py +++ b/pype/plugins/nuke/publish/submit_nuke_deadline.py @@ -125,8 +125,7 @@ class NukeSubmitDeadline(pyblish.api.InstancePlugin): # Optional, enable double-click to preview rendered # frames from Deadline Monitor - "OutputFilename0": output_filename_0.replace("\\", "/"), - "OutputDirectory0": output_directory_0 + "OutputFilename0": output_filename_0.replace("\\", "/") }, "PluginInfo": { From 073855cb5f4f203447a71338d0a961f0745ddc08 Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Mon, 2 Mar 2020 22:37:55 +0100 Subject: [PATCH 15/16] add all outputs to deadline OutputFilename --- .../maya/publish/submit_maya_deadline.py | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/pype/plugins/maya/publish/submit_maya_deadline.py b/pype/plugins/maya/publish/submit_maya_deadline.py index 2f236be424..bd8497152e 100644 --- a/pype/plugins/maya/publish/submit_maya_deadline.py +++ b/pype/plugins/maya/publish/submit_maya_deadline.py @@ -1,6 +1,7 @@ import os import json import getpass +import clique from maya import cmds @@ -242,7 +243,8 @@ class MayaSubmitDeadline(pyblish.api.InstancePlugin): # Optional, enable double-click to preview rendered # frames from Deadline Monitor - "OutputFilename0": output_filename_0.replace("\\", "/"), + "OutputDirectory0": os.path.dirname(output_filename_0), + "OutputFilename0": output_filename_0.replace("\\", "/") }, "PluginInfo": { # Input @@ -272,6 +274,26 @@ class MayaSubmitDeadline(pyblish.api.InstancePlugin): "AuxFiles": [] } + exp = instance.data.get("expectedFiles") + + OutputFilenames = {} + expIndex = 0 + + if isinstance(exp[0], dict): + # we have aovs and we need to iterate over them + for aov, files in exp[0].items(): + col = clique.assemble(files)[0][0] + outputFile = col.format('{head}{padding}{tail}') + payload['JobInfo']['OutputFilename' + str(expIndex)] = outputFile + OutputFilenames[expIndex] = outputFile + expIndex += 1 + else: + col = clique.assemble(files)[0][0] + outputFile = col.format('{head}{padding}{tail}') + payload['JobInfo']['OutputFilename' + str(expIndex)] = outputFile + # OutputFilenames[expIndex] = outputFile + + # We need those to pass them to pype for it to set correct context keys = [ "FTRACK_API_KEY", From a7605c6c502ccf857e273e6b772f2b9f1f80bf74 Mon Sep 17 00:00:00 2001 From: Milan Kolar Date: Mon, 2 Mar 2020 22:38:17 +0100 Subject: [PATCH 16/16] add handles and fps to cg renders publishing --- pype/plugins/global/publish/submit_publish_job.py | 6 +++++- pype/plugins/maya/publish/collect_render.py | 2 ++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pype/plugins/global/publish/submit_publish_job.py b/pype/plugins/global/publish/submit_publish_job.py index 80b3137673..cb835bff11 100644 --- a/pype/plugins/global/publish/submit_publish_job.py +++ b/pype/plugins/global/publish/submit_publish_job.py @@ -544,6 +544,10 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): if handle_end is None: handle_end = context.data["handleEnd"] + fps = instance.data.get("fps") + if fps is None: + fps = context.data["fps"] + if data.get("extendFrames", False): start, end = self._extend_frames( asset, @@ -574,7 +578,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): "frameEnd": end, "handleStart": handle_start, "handleEnd": handle_end, - "fps": data["fps"], + "fps": fps, "source": source, "extendFrames": data.get("extendFrames"), "overrideExistingFrame": data.get("overrideExistingFrame"), diff --git a/pype/plugins/maya/publish/collect_render.py b/pype/plugins/maya/publish/collect_render.py index 07eec4192f..f31198448b 100644 --- a/pype/plugins/maya/publish/collect_render.py +++ b/pype/plugins/maya/publish/collect_render.py @@ -220,6 +220,8 @@ class CollectMayaRender(pyblish.api.ContextPlugin): layer=layer_name)), "renderer": self.get_render_attribute("currentRenderer", layer=layer_name), + "handleStart": context.data["assetEntity"]['data']['handleStart'], + "handleEnd": context.data["assetEntity"]['data']['handleEnd'], # instance subset "family": "renderlayer",