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

Commit

Permalink
Merge pull request #3427 from pypeclub/bugfix/nuke_slate_is_integrated
Browse files Browse the repository at this point in the history
Nuke: Slate frame is integrated
  • Loading branch information
iLLiCiTiT authored Jun 30, 2022
2 parents 36ef8e5 + 7c48b61 commit 5738bdd
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
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

0 comments on commit 5738bdd

Please sign in to comment.