From ac78278a950d1ed0d0569e60f1fbb24f346e4e11 Mon Sep 17 00:00:00 2001 From: Toke Stuart Jepsen Date: Fri, 19 Jun 2020 12:18:03 +0100 Subject: [PATCH] Defaults for frameStart and frameEnd Only warn users about missing attributes. --- .../global/publish/collect_avalon_entities.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/pype/plugins/global/publish/collect_avalon_entities.py b/pype/plugins/global/publish/collect_avalon_entities.py index 51dd3d7b06..917172d40c 100644 --- a/pype/plugins/global/publish/collect_avalon_entities.py +++ b/pype/plugins/global/publish/collect_avalon_entities.py @@ -48,8 +48,18 @@ class CollectAvalonEntities(pyblish.api.ContextPlugin): data = asset_entity['data'] - context.data["frameStart"] = data.get("frameStart") - context.data["frameEnd"] = data.get("frameEnd") + frame_start = data.get("frameStart") + if frame_start is None: + frame_start = 1 + self.log.warning("Missing frame start. Defaulting to 1.") + + frame_end = data.get("frameEnd") + if frame_end is None: + frame_end = 2 + self.log.warning("Missing frame end. Defaulting to 2.") + + context.data["frameStart"] = frame_start + context.data["frameEnd"] = frame_end handles = data.get("handles") or 0 handle_start = data.get("handleStart") @@ -72,7 +82,7 @@ class CollectAvalonEntities(pyblish.api.ContextPlugin): context.data["handleStart"] = int(handle_start) context.data["handleEnd"] = int(handle_end) - frame_start_h = data.get("frameStart") - context.data["handleStart"] - frame_end_h = data.get("frameEnd") + context.data["handleEnd"] + frame_start_h = frame_start - context.data["handleStart"] + frame_end_h = frame_end + context.data["handleEnd"] context.data["frameStartHandle"] = frame_start_h context.data["frameEndHandle"] = frame_end_h