Merge pull request #2853 from pypeclub/bugfix/nuke-slate-with-bake-reformat

Nuke: slate resolution to input video resolution
This commit is contained in:
Jakub Ježek 2022-03-10 16:16:12 +01:00 committed by GitHub
commit ba1ac111df
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 56 additions and 12 deletions

View file

@ -48,8 +48,13 @@ class ExtractSlateFrame(openpype.api.Extractor):
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 = []

View file

@ -1159,12 +1159,26 @@ class ExtractReview(pyblish.api.InstancePlugin):
# - 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((
@ -1173,8 +1187,8 @@ class ExtractReview(pyblish.api.InstancePlugin):
# 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"

View file

@ -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):
@ -59,13 +59,44 @@ class ExtractReviewSlate(openpype.api.Extractor):
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 = (
@ -94,15 +125,9 @@ class ExtractReviewSlate(openpype.api.Extractor):
_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(