Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Nuke: Slate frame is integrated #3427

Merged
merged 2 commits into from
Jun 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 43 additions & 1 deletion openpype/hosts/nuke/plugins/publish/extract_slate_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import copy

import pyblish.api
import six

import openpype
from openpype.hosts.nuke.api import (
Expand All @@ -12,7 +13,6 @@
get_view_process_node
)


class ExtractSlateFrame(openpype.api.Extractor):
"""Extracts movie and thumbnail with baked in luts

Expand Down Expand Up @@ -236,6 +236,48 @@ def _render_slate_to_sequence(self, instance):
int(slate_first_frame)
)

# Add file to representation files
# - get write node
write_node = instance.data["writeNode"]
# - evaluate filepaths for first frame and slate frame
first_filename = os.path.basename(
write_node["file"].evaluate(first_frame))
slate_filename = os.path.basename(
write_node["file"].evaluate(slate_first_frame))

# Find matching representation based on first filename
matching_repre = None
is_sequence = None
for repre in instance.data["representations"]:
files = repre["files"]
if (
not isinstance(files, six.string_types)
and first_filename in files
):
matching_repre = repre
is_sequence = True
break

elif files == first_filename:
matching_repre = repre
is_sequence = False
break

if not matching_repre:
self.log.info((
"Matching reresentaion was not found."
" Representation files were not filled with slate."
))
return

# Add frame to matching representation files
if not is_sequence:
matching_repre["files"] = [first_filename, slate_filename]
elif slate_filename not in matching_repre["files"]:
matching_repre["files"].insert(0, slate_filename)

self.log.warning("Added slate frame to representation files")

def add_comment_slate_node(self, instance, node):

comment = instance.context.data.get("comment")
Expand Down
1 change: 1 addition & 0 deletions openpype/hosts/nuke/plugins/publish/precollect_writes.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def process(self, instance):
if node is None:
return

instance.data["writeNode"] = node
self.log.debug("checking instance: {}".format(instance))

# Determine defined file type
Expand Down