feat(nks): if user writes source to Tags value it will get source frames

This commit is contained in:
Jakub Jezek 2019-08-12 13:10:12 +02:00
parent 30f4f13809
commit 44814124f8

View file

@ -1,5 +1,5 @@
from pyblish import api
import os
class CollectClipTagFrameStart(api.InstancePlugin):
"""Collect FrameStart from Tags of selected track items."""
@ -19,8 +19,20 @@ class CollectClipTagFrameStart(api.InstancePlugin):
# gets only task family tags and collect labels
if "frameStart" in t_family:
t_value = t_metadata.get("tag.value", "")
# backward compatibility
t_number = t_metadata.get("tag.number", "")
start_frame = int(t_number)
try:
start_frame = int(t_number) or int(t_value)
except ValueError:
if "source" in t_value:
source_first = instance.data["sourceFirst"]
source_in = instance.data["sourceIn"]
handle_start = instance.data["handleStart"]
start_frame = (source_first + source_in) - handle_start
instance.data["startingFrame"] = start_frame
self.log.info("Start frame on `{0}` set to `{1}`".format(
instance, start_frame