From 4df0ca8e62931bee36fd38ba9d2d3f4ad78fb6d8 Mon Sep 17 00:00:00 2001 From: Jakub Jezek Date: Fri, 17 Jan 2020 18:23:28 +0100 Subject: [PATCH] fix: offset if slate in collect filesequence --- .../global/publish/collect_filesequences.py | 30 ++++++++++++------- pype/plugins/global/publish/integrate_new.py | 2 +- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/pype/plugins/global/publish/collect_filesequences.py b/pype/plugins/global/publish/collect_filesequences.py index c4ba064088..2d8dd1b1c2 100644 --- a/pype/plugins/global/publish/collect_filesequences.py +++ b/pype/plugins/global/publish/collect_filesequences.py @@ -12,7 +12,6 @@ import os import re import copy import json -from pprint import pformat import pyblish.api from avalon import api @@ -104,6 +103,8 @@ class CollectRenderedFrames(pyblish.api.ContextPlugin): families_data = None subset = None version = None + frame_start = 0 + frame_end = 0 if os.environ.get("PYPE_PUBLISH_PATHS"): paths = os.environ["PYPE_PUBLISH_PATHS"].split(os.pathsep) self.log.info("Collecting paths: {}".format(paths)) @@ -129,6 +130,9 @@ class CollectRenderedFrames(pyblish.api.ContextPlugin): cwd = os.path.dirname(path) root_override = data.get("root") + frame_start = int(data.get("frameStart")) + frame_end = int(data.get("frameEnd")) + if root_override: if os.path.isabs(root_override): root = root_override @@ -177,12 +181,15 @@ class CollectRenderedFrames(pyblish.api.ContextPlugin): if regex: self.log.info("Using regex: {}".format(regex)) + if "slate" in families_data: + frame_start -= 1 + collections, remainder = collect( root=root, regex=regex, exclude_regex=data.get("exclude_regex"), - frame_start=data.get("frameStart"), - frame_end=data.get("frameEnd"), + frame_start=frame_start, + frame_end=frame_end, ) self.log.info("Found collections: {}".format(collections)) @@ -223,8 +230,8 @@ class CollectRenderedFrames(pyblish.api.ContextPlugin): "asset": data.get( "asset", api.Session["AVALON_ASSET"]), "stagingDir": root, - "frameStart": data.get("frameStart"), - "frameEnd": data.get("frameEnd"), + "frameStart": frame_start, + "frameEnd": frame_end, "fps": fps, "source": data.get("source", ""), "pixelAspect": pixel_aspect, @@ -260,8 +267,6 @@ class CollectRenderedFrames(pyblish.api.ContextPlugin): # take out review family if mov path # this will make imagesequence none review - frame_start = data.get("frameStart") - frame_end = data.get("frameEnd") if baked_mov_path: self.log.info( @@ -269,9 +274,6 @@ class CollectRenderedFrames(pyblish.api.ContextPlugin): baked_mov_path)) families.append("review") - if "slate" in families: - frame_start -= 1 - self.log.info( "Adding representations to subset {}".format( subset)) @@ -307,6 +309,9 @@ class CollectRenderedFrames(pyblish.api.ContextPlugin): self.log.info(" - {}".format(str(collection))) ext = collection.tail.lstrip(".") + + if "slate" in instance.data["families"]: + frame_start += 1 representation = { "name": ext, @@ -411,3 +416,8 @@ class CollectRenderedFrames(pyblish.api.ContextPlugin): "tags": ["review"], } instance.data["representations"].append(representation) + self.log.debug( + "__ representations {}".format( + instance.data["representations"])) + self.log.debug( + "__ instance.data {}".format(instance.data)) diff --git a/pype/plugins/global/publish/integrate_new.py b/pype/plugins/global/publish/integrate_new.py index f1a125c4b2..a3a4996ca4 100644 --- a/pype/plugins/global/publish/integrate_new.py +++ b/pype/plugins/global/publish/integrate_new.py @@ -7,7 +7,7 @@ import errno import pyblish.api from avalon import api, io from avalon.vendor import filelink -from pathlib2 import Path + # this is needed until speedcopy for linux is fixed if sys.platform == "win32": from speedcopy import copyfile