From 255947b2a57c63b2532bf2f12fa7a4a48104bc9f Mon Sep 17 00:00:00 2001 From: Ondrej Samohel Date: Wed, 5 Feb 2020 18:54:21 +0100 Subject: [PATCH] fixing maya renders dir, normalizing path before copying --- .../global/publish/collect_filesequences.py | 45 ++++++++++++++++--- pype/plugins/global/publish/integrate_new.py | 3 +- pype/plugins/maya/publish/collect_render.py | 2 +- 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/pype/plugins/global/publish/collect_filesequences.py b/pype/plugins/global/publish/collect_filesequences.py index 83fe9e8a4b..59b2623877 100644 --- a/pype/plugins/global/publish/collect_filesequences.py +++ b/pype/plugins/global/publish/collect_filesequences.py @@ -108,6 +108,8 @@ class CollectRenderedFrames(pyblish.api.ContextPlugin): version = None frame_start = 0 frame_end = 0 + new_instance = None + if os.environ.get("PYPE_PUBLISH_PATHS"): paths = os.environ["PYPE_PUBLISH_PATHS"].split(os.pathsep) self.log.info("Collecting paths: {}".format(paths)) @@ -394,6 +396,7 @@ class CollectRenderedFrames(pyblish.api.ContextPlugin): else: # we have no subset so we take every collection and create one # from it + if regex: for collection in collections: new_instance = context.create_instance(str(collection)) @@ -471,11 +474,39 @@ class CollectRenderedFrames(pyblish.api.ContextPlugin): new_instance.data['families'].remove( 'ftrack') representation["tags"].remove('review') + else: + subset = data["metadata"]["instance"]["subset"] + self.log.info("Creating new subset: {}".format(subset)) + new_instance = context.create_instance(subset) + data = copy.deepcopy(data) + new_instance.data.update( + { + "name": subset, + "family": 'render', + "families": ['render'], + "subset": subset, + "asset": data.get( + "asset", api.Session["AVALON_ASSET"]), + "stagingDir": root, + "frameStart": frame_start, + "frameEnd": frame_end, + "fps": fps, + "source": data.get("source", ""), + "pixelAspect": pixel_aspect, + "resolutionWidth": resolution_width, + "resolutionHeight": resolution_height, + "slateFrame": slate_frame + } + ) + new_instance.data["representations"] = data["metadata"]["instance"]["representations"] - self.log.info("remapping paths ...") - new_instance.data["representations"] = [PypeLauncher.path_remapper(r) for r in new_instance.data["representations"]] # noqa: E501 - self.log.debug( - "__ representations {}".format( - new_instance.data["representations"])) - self.log.debug( - "__ instance.data {}".format(new_instance.data)) + if new_instance: + self.log.info("remapping paths ...") + new_instance.data["representations"] = [PypeLauncher.path_remapper(r) for r in new_instance.data["representations"]] # noqa: E501 + self.log.debug( + "__ representations {}".format( + new_instance.data["representations"])) + self.log.debug( + "__ instance.data {}".format(new_instance.data)) + else: + self.log.error("nothing collected") diff --git a/pype/plugins/global/publish/integrate_new.py b/pype/plugins/global/publish/integrate_new.py index 7d95534897..dc5dc7be94 100644 --- a/pype/plugins/global/publish/integrate_new.py +++ b/pype/plugins/global/publish/integrate_new.py @@ -511,7 +511,8 @@ class IntegrateAssetNew(pyblish.api.InstancePlugin): """ src = self.unc_convert(src) dst = self.unc_convert(dst) - + src = os.path.normpath(src) + dst = os.path.normpath(dst) self.log.debug("Copying file .. {} -> {}".format(src, dst)) dirname = os.path.dirname(dst) try: diff --git a/pype/plugins/maya/publish/collect_render.py b/pype/plugins/maya/publish/collect_render.py index 0cab118b2e..4096ef3c0e 100644 --- a/pype/plugins/maya/publish/collect_render.py +++ b/pype/plugins/maya/publish/collect_render.py @@ -124,7 +124,7 @@ class CollectMayaRender(pyblish.api.ContextPlugin): # append full path full_exp_files = [] for ef in exp_files: - full_path = os.path.join(workspace, "render", ef) + full_path = os.path.join(workspace, "renders", ef) full_path = full_path.replace("\\", "/") full_exp_files.append(full_path)