Skip to content

Commit

Permalink
Merge pull request #3555 from pypeclub/bugfix/OP-3556_Nuke-Farm-slate…
Browse files Browse the repository at this point in the history
…-existing-frames-frame-shorter

Nuke: publish existing frames with slate with correct range
  • Loading branch information
jakubjezek001 committed Jul 27, 2022
2 parents 830e79c + 427c61f commit bc24787
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 25 deletions.
2 changes: 0 additions & 2 deletions openpype/hosts/nuke/api/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,6 @@ def get_file_info(self):
# get first and last frame
self.first_frame = min(self.collection.indexes)
self.last_frame = max(self.collection.indexes)
if "slate" in self.instance.data["families"]:
self.first_frame += 1
else:
self.fname = os.path.basename(self.path_in)
self.fhead = os.path.splitext(self.fname)[0] + "."
Expand Down
1 change: 1 addition & 0 deletions openpype/hosts/nuke/plugins/publish/collect_slate_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def process(self, instance):

if slate_node:
instance.data["slateNode"] = slate_node
instance.data["slate"] = True
instance.data["families"].append("slate")
instance.data["versionData"]["families"].append("slate")
self.log.info(
Expand Down
15 changes: 5 additions & 10 deletions openpype/hosts/nuke/plugins/publish/extract_render_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,6 @@ def process(self, instance):

first_frame = instance.data.get("frameStartHandle", None)

# exception for slate workflow
if "slate" in families:
first_frame -= 1

last_frame = instance.data.get("frameEndHandle", None)
node_subset_name = instance.data.get("name", None)

Expand Down Expand Up @@ -68,10 +64,6 @@ def process(self, instance):
int(last_frame)
)

# exception for slate workflow
if "slate" in families:
first_frame += 1

ext = node["file_type"].value()

if "representations" not in instance.data:
Expand All @@ -88,8 +80,11 @@ def process(self, instance):
repre = {
'name': ext,
'ext': ext,
'frameStart': "%0{}d".format(
len(str(last_frame))) % first_frame,
'frameStart': (
"{{:0>{}}}"
.format(len(str(last_frame)))
.format(first_frame)
),
'files': filenames,
"stagingDir": out_dir
}
Expand Down
9 changes: 9 additions & 0 deletions openpype/hosts/nuke/plugins/publish/extract_slate_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
get_view_process_node
)


class ExtractSlateFrame(openpype.api.Extractor):
"""Extracts movie and thumbnail with baked in luts
Expand Down Expand Up @@ -236,6 +237,7 @@ def render_slate(
def _render_slate_to_sequence(self, instance):
# set slate frame
first_frame = instance.data["frameStartHandle"]
last_frame = instance.data["frameEndHandle"]
slate_first_frame = first_frame - 1

# render slate as sequence frame
Expand Down Expand Up @@ -284,6 +286,13 @@ def _render_slate_to_sequence(self, instance):
matching_repre["files"] = [first_filename, slate_filename]
elif slate_filename not in matching_repre["files"]:
matching_repre["files"].insert(0, slate_filename)
matching_repre["frameStart"] = (
"{{:0>{}}}"
.format(len(str(last_frame)))
.format(slate_first_frame)
)
self.log.debug(
"__ matching_repre: {}".format(pformat(matching_repre)))

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def process(self, instance):
self.log.error(msg)
raise ValidationException(msg)

collected_frames_len = int(len(collection.indexes))
collected_frames_len = len(collection.indexes)
coll_start = min(collection.indexes)
coll_end = max(collection.indexes)

Expand Down
15 changes: 5 additions & 10 deletions openpype/modules/deadline/plugins/publish/submit_nuke_deadline.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ def process(self, instance):
"Using published scene for render {}".format(script_path)
)

# exception for slate workflow
if "slate" in instance.data["families"]:
submit_frame_start -= 1

response = self.payload_submit(
instance,
script_path,
Expand All @@ -99,10 +95,6 @@ def process(self, instance):
instance.data["publishJobState"] = "Suspended"

if instance.data.get("bakingNukeScripts"):
# exception for slate workflow
if "slate" in instance.data["families"]:
submit_frame_start += 1

for baking_script in instance.data["bakingNukeScripts"]:
render_path = baking_script["bakeRenderPath"]
script_path = baking_script["bakeScriptPath"]
Expand Down Expand Up @@ -365,7 +357,7 @@ def expected_files(
if not instance.data.get("expectedFiles"):
instance.data["expectedFiles"] = []

dir = os.path.dirname(path)
dirname = os.path.dirname(path)
file = os.path.basename(path)

if "#" in file:
Expand All @@ -377,9 +369,12 @@ def expected_files(
instance.data["expectedFiles"].append(path)
return

if instance.data.get("slate"):
start_frame -= 1

for i in range(start_frame, (end_frame + 1)):
instance.data["expectedFiles"].append(
os.path.join(dir, (file % i)).replace("\\", "/"))
os.path.join(dirname, (file % i)).replace("\\", "/"))

def get_limit_groups(self):
"""Search for limit group nodes and return group name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ class ProcessSubmittedJobOnFarm(pyblish.api.InstancePlugin):
# mapping of instance properties to be transfered to new instance for every
# specified family
instance_transfer = {
"slate": ["slateFrames"],
"slate": ["slateFrames", "slate"],
"review": ["lutPath"],
"render2d": ["bakingNukeScripts", "version"],
"renderlayer": ["convertToScanline"]
Expand Down Expand Up @@ -585,11 +585,15 @@ def _get_representations(self, instance, exp_files):
" This may cause issues on farm."
).format(staging))

frame_start = int(instance.get("frameStartHandle"))
if instance.get("slate"):
frame_start -= 1

rep = {
"name": ext,
"ext": ext,
"files": [os.path.basename(f) for f in list(collection)],
"frameStart": int(instance.get("frameStartHandle")),
"frameStart": frame_start,
"frameEnd": int(instance.get("frameEndHandle")),
# If expectedFile are absolute, we need only filenames
"stagingDir": staging,
Expand Down

0 comments on commit bc24787

Please sign in to comment.