diff --git a/pype/nuke/lib.py b/pype/nuke/lib.py index 4cf2f0c9c5..90df78d072 100644 --- a/pype/nuke/lib.py +++ b/pype/nuke/lib.py @@ -1460,14 +1460,13 @@ class ExporterReviewMov(ExporterReview): self.log.info("Rendered...") def save_file(self): + import shutil with anlib.maintained_selection(): self.log.info("Saving nodes as file... ") - # select temp nodes - anlib.select_nodes(self._temp_nodes) # create nk path path = os.path.splitext(self.path)[0] + ".nk" # save file to the path - nuke.nodeCopy(path) + shutil.copyfile(self.instance.context.data["currentFile"], path) self.log.info("Nodes exported...") return path @@ -1522,6 +1521,7 @@ class ExporterReviewMov(ExporterReview): # ---------- render or save to nk if farm: + nuke.scriptSave() path_nk = self.save_file() self.data.update({ "bakeScriptPath": path_nk, @@ -1540,7 +1540,7 @@ class ExporterReviewMov(ExporterReview): # ---------- Clean up self.clean_nodes() - + nuke.scriptSave() return self.data diff --git a/pype/plugins/global/publish/collect_filesequences.py b/pype/plugins/global/publish/collect_filesequences.py index 3840105fe5..6fa513d05f 100644 --- a/pype/plugins/global/publish/collect_filesequences.py +++ b/pype/plugins/global/publish/collect_filesequences.py @@ -101,6 +101,7 @@ class CollectRenderedFrames(pyblish.api.ContextPlugin): resolution_height = 1080 lut_path = None slate_frame = None + families_data = None subset = None if os.environ.get("PYPE_PUBLISH_PATHS"): paths = os.environ["PYPE_PUBLISH_PATHS"].split(os.pathsep) @@ -157,6 +158,7 @@ class CollectRenderedFrames(pyblish.api.ContextPlugin): lut_path = instance.get("lutPath", None) baked_mov_path = instance.get("bakeRenderPath") subset = instance.get("subset") + families_data = instance.get("families") slate_frame = instance.get("slateFrame") else: @@ -197,6 +199,8 @@ class CollectRenderedFrames(pyblish.api.ContextPlugin): families.append("ftrack") if "write" in instance_family: families.append("write") + if families_data and "slate" in families_data: + families.append("slate") if data.get("attachTo"): # we need to attach found collections to existing diff --git a/pype/plugins/global/publish/integrate_new.py b/pype/plugins/global/publish/integrate_new.py index 16fbad1df0..a15c296b11 100644 --- a/pype/plugins/global/publish/integrate_new.py +++ b/pype/plugins/global/publish/integrate_new.py @@ -357,7 +357,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): dst_head, dst_start_frame, dst_tail).replace("..", ".") - repre['published_path'] = dst + repre['published_path'] = self.unc_convert(dst) else: # Single file @@ -386,7 +386,7 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): instance.data["transfers"].append([src, dst]) - repre['published_path'] = dst + repre['published_path'] = self.unc_convert(dst) self.log.debug("__ dst: {}".format(dst)) representation = { @@ -460,6 +460,27 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): self.log.debug("Hardlinking file .. {} -> {}".format(src, dest)) 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 ..") + 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: + path = path.replace(path_mount, path_replace) + return path + def copy_file(self, src, dst): """ Copy given source to destination @@ -469,11 +490,8 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): Returns: None """ - - src = str(Path(src).resolve()) - drive, _path = os.path.splitdrive(dst) - unc = Path(drive).resolve() - dst = str(unc) + _path + src = self.unc_convert(src) + dst = self.unc_convert(dst) self.log.debug("Copying file .. {} -> {}".format(src, dst)) dirname = os.path.dirname(dst) @@ -495,10 +513,8 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): def hardlink_file(self, src, dst): dirname = os.path.dirname(dst) - src = str(Path(src).resolve()) - drive, _path = os.path.splitdrive(dst) - unc = Path(drive).resolve() - dst = str(unc) + _path + src = self.unc_convert(src) + dst = self.unc_convert(dst) try: os.makedirs(dirname) diff --git a/pype/plugins/global/publish/submit_publish_job.py b/pype/plugins/global/publish/submit_publish_job.py index 03bd25fb49..3ac0247dc0 100644 --- a/pype/plugins/global/publish/submit_publish_job.py +++ b/pype/plugins/global/publish/submit_publish_job.py @@ -202,19 +202,27 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin): # job so they use the same environment environment = job["Props"].get("Env", {}) + + environment = dict( + {key: os.environ[key] for key in self.enviro_filter + if key in environment}, **api.Session) + + self.log.debug("___> enviro: {}".format(environment)) + for _key in os.environ: + if _key.lower().startswith('pype_'): + environment[_key] = os.environ[_key] + i = 0 for index, key in enumerate(environment): self.log.info("KEY: {}".format(key)) - self.log.info("FILTER: {}".format(self.enviro_filter)) - if key.upper() in self.enviro_filter: - payload["JobInfo"].update({ - "EnvironmentKeyValue%d" % i: "{key}={value}".format( - key=key, - value=environment[key] - ) - }) - i += 1 + payload["JobInfo"].update({ + "EnvironmentKeyValue%d" % i: "{key}={value}".format( + key=key, + value=environment[key] + ) + }) + i += 1 # Avoid copied pools and remove secondary pool payload["JobInfo"]["Pool"] = "none" diff --git a/pype/plugins/nuke/publish/extract_review_data_mov.py b/pype/plugins/nuke/publish/extract_review_data_mov.py index 34bb28e9b8..e3201371f2 100644 --- a/pype/plugins/nuke/publish/extract_review_data_mov.py +++ b/pype/plugins/nuke/publish/extract_review_data_mov.py @@ -16,23 +16,26 @@ class ExtractReviewDataMov(pype.api.Extractor): order = pyblish.api.ExtractorOrder + 0.01 label = "Extract Review Data Mov" - families = ["review"] + families = ["review", "render", "render.local"] hosts = ["nuke"] def process(self, instance): families = instance.data["families"] + self.log.info("Creating staging dir...") + self.log.debug( + "__ representations: `{}`".format( + instance.data["representations"])) if "representations" in instance.data: - staging_dir = instance.data[ - "representations"][0]["stagingDir"].replace("\\", "/") - instance.data["stagingDir"] = staging_dir - instance.data["representations"][0]["tags"] = [] - else: - instance.data["representations"] = [] - # get output path - render_path = instance.data['path'] - staging_dir = os.path.normpath(os.path.dirname(render_path)) - instance.data["stagingDir"] = staging_dir + if instance.data["representations"] == []: + render_path = instance.data['path'] + staging_dir = os.path.normpath(os.path.dirname(render_path)) + instance.data["stagingDir"] = staging_dir + else: + staging_dir = instance.data[ + "representations"][0]["stagingDir"].replace("\\", "/") + instance.data["representations"][0]["tags"] = [] + instance.data["stagingDir"] = staging_dir self.log.info( "StagingDir `{0}`...".format(instance.data["stagingDir"])) diff --git a/pype/plugins/nuke/publish/extract_slate_frame.py b/pype/plugins/nuke/publish/extract_slate_frame.py index 333cd9f7c1..a0f1c06828 100644 --- a/pype/plugins/nuke/publish/extract_slate_frame.py +++ b/pype/plugins/nuke/publish/extract_slate_frame.py @@ -98,7 +98,7 @@ class ExtractSlateFrame(pype.api.Extractor): # fill slate node with comments self.add_comment_slate_node(instance) - + # Render frames nuke.execute(write_node.name(), int(first_frame), int(last_frame)) @@ -149,3 +149,4 @@ class ExtractSlateFrame(pype.api.Extractor): node["f_submitting_for"].setValue(intent) except NameError: return + instance.data.pop("slateNode") diff --git a/pype/plugins/nuke/publish/extract_thumbnail.py b/pype/plugins/nuke/publish/extract_thumbnail.py index efcfb4f87a..8a762d7b89 100644 --- a/pype/plugins/nuke/publish/extract_thumbnail.py +++ b/pype/plugins/nuke/publish/extract_thumbnail.py @@ -30,9 +30,15 @@ class ExtractThumbnail(pype.api.Extractor): def render_thumbnail(self, instance): node = instance[0] # group node self.log.info("Creating staging dir...") + self.log.debug( + "_ representations `{0}`".format(instance.data["representations"])) if "representations" in instance.data: - staging_dir = instance.data[ - "representations"][0]["stagingDir"].replace("\\", "/") + try: + staging_dir = instance.data[ + "representations"][0]["stagingDir"].replace("\\", "/") + except IndexError: + path = instance.data["path"] + staging_dir = os.path.dirname(path) instance.data["stagingDir"] = staging_dir else: instance.data["representations"] = [] diff --git a/setup/nuke/nuke_path/menu.py b/setup/nuke/nuke_path/menu.py index fd87c98246..8c92b77e80 100644 --- a/setup/nuke/nuke_path/menu.py +++ b/setup/nuke/nuke_path/menu.py @@ -16,6 +16,6 @@ log = Logger().get_logger(__name__, "nuke") nuke.addOnScriptSave(onScriptLoad) nuke.addOnScriptLoad(checkInventoryVersions) nuke.addOnScriptSave(checkInventoryVersions) -nuke.addOnScriptSave(writes_version_sync) +# nuke.addOnScriptSave(writes_version_sync) log.info('Automatic syncing of write file knob to script version')