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

Nuke: slate resolution to input video resolution #2853

Merged
merged 5 commits into from
Mar 10, 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
7 changes: 6 additions & 1 deletion openpype/hosts/nuke/plugins/publish/extract_slate_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,13 @@ def render_slate(self, instance):
self.log.info(
"StagingDir `{0}`...".format(instance.data["stagingDir"]))

frame_start = instance.data["frameStart"]
frame_end = instance.data["frameEnd"]
handle_start = instance.data["handleStart"]
handle_end = instance.data["handleEnd"]

frame_length = int(
instance.data["frameEnd"] - instance.data["frameStart"] + 1
(frame_end - frame_start + 1) + (handle_start + handle_end)
)

temporary_nodes = []
Expand Down
18 changes: 16 additions & 2 deletions openpype/plugins/publish/extract_review.py
Original file line number Diff line number Diff line change
Expand Up @@ -1159,12 +1159,26 @@ def rescaling_filters(self, temp_data, output_def, new_repre):
# - there may be a better way (checking `codec_type`?)
input_width = None
input_height = None
output_width = None
output_height = None
for stream in streams:
if "width" in stream and "height" in stream:
input_width = int(stream["width"])
input_height = int(stream["height"])
break

# Get instance data
pixel_aspect = temp_data["pixel_aspect"]

if reformat_in_baking:
self.log.debug((
"Using resolution from input. It is already "
"reformated from upstream process"
))
pixel_aspect = 1
output_width = input_width
output_height = input_height

# Raise exception of any stream didn't define input resolution
if input_width is None:
raise AssertionError((
Expand All @@ -1173,8 +1187,8 @@ def rescaling_filters(self, temp_data, output_def, new_repre):

# NOTE Setting only one of `width` or `heigth` is not allowed
# - settings value can't have None but has value of 0
output_width = output_def.get("width") or None
output_height = output_def.get("height") or None
output_width = output_width or output_def.get("width") or None
output_height = output_height or output_def.get("height") or None

# Overscal color
overscan_color_value = "black"
Expand Down
43 changes: 34 additions & 9 deletions openpype/plugins/publish/extract_review_slate.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ExtractReviewSlate(openpype.api.Extractor):
families = ["slate", "review"]
match = pyblish.api.Subset

hosts = ["nuke", "maya", "shell"]
hosts = ["nuke", "shell"]
optional = True

def process(self, instance):
Expand Down Expand Up @@ -59,13 +59,44 @@ def process(self, instance):
if "slate-frame" not in p_tags:
continue

# get repre file
stagingdir = repre["stagingDir"]
input_file = "{0}".format(repre["files"])
input_path = os.path.join(
os.path.normpath(stagingdir), repre["files"])
self.log.debug("__ input_path: {}".format(input_path))

video_streams = openpype.lib.ffprobe_streams(
input_path, self.log
)

# Try to find first stream with defined 'width' and 'height'
# - this is to avoid order of streams where audio can be as first
# - there may be a better way (checking `codec_type`?)
input_width = None
input_height = None
for stream in video_streams:
if "width" in stream and "height" in stream:
input_width = int(stream["width"])
input_height = int(stream["height"])
break

# Raise exception of any stream didn't define input resolution
if input_width is None:
raise AssertionError((
"FFprobe couldn't read resolution from input file: \"{}\""
).format(input_path))

# values are set in ExtractReview
if use_legacy_code:
to_width = inst_data["reviewToWidth"]
to_height = inst_data["reviewToHeight"]
else:
to_width = repre["resolutionWidth"]
to_height = repre["resolutionHeight"]
to_width = input_width
to_height = input_height

self.log.debug("to_width: `{}`".format(to_width))
self.log.debug("to_height: `{}`".format(to_height))

# defining image ratios
resolution_ratio = (
Expand Down Expand Up @@ -94,15 +125,9 @@ def process(self, instance):

_remove_at_end = []

stagingdir = repre["stagingDir"]
input_file = "{0}".format(repre["files"])

ext = os.path.splitext(input_file)[1]
output_file = input_file.replace(ext, "") + suffix + ext

input_path = os.path.join(
os.path.normpath(stagingdir), repre["files"])
self.log.debug("__ input_path: {}".format(input_path))
_remove_at_end.append(input_path)

output_path = os.path.join(
Expand Down