feat(nk): dealing with slate if render family in write collector

This commit is contained in:
Jakub Jezek 2020-02-18 14:53:47 +01:00
parent c4f049f64e
commit cc1c176ef0
No known key found for this signature in database
GPG key ID: C4B96E101D2A47F3

View file

@ -41,7 +41,10 @@ class CollectNukeWrites(pyblish.api.InstancePlugin):
handle_end = instance.context.data["handleEnd"]
first_frame = int(nuke.root()["first_frame"].getValue())
last_frame = int(nuke.root()["last_frame"].getValue())
frame_length = int(
last_frame - first_frame + 1
)
if node["use_limit"].getValue():
handles = 0
first_frame = int(node["first"].getValue())
@ -82,8 +85,17 @@ class CollectNukeWrites(pyblish.api.InstancePlugin):
collected_frames = [f for f in os.listdir(output_dir)
if ext in f]
if collected_frames:
representation['frameStart'] = "%0{}d".format(
collected_frames_len = len(collected_frames)
frame_start_str = "%0{}d".format(
len(str(last_frame))) % first_frame
representation['frameStart'] = frame_start_str
if "slate" in instance.data["families"] \
and (frame_length != collected_frames_len):
frame_slate_str = "%0{}d".format(
len(str(last_frame))) % (first_frame - 1)
slate_frame = collected_frames[0].replace(
frame_start_str, frame_slate_str)
collected_frames.insert(0, slate_frame)
representation['files'] = collected_frames
instance.data["representations"].append(representation)
except Exception: