use frame range with handles in global review plugins

This commit is contained in:
Milan Kolar 2020-03-13 23:50:45 +01:00
parent 562e59880a
commit 9265f20cc7
2 changed files with 29 additions and 23 deletions

View file

@ -35,17 +35,20 @@ class ExtractBurnin(pype.api.Extractor):
context_data.get("handleStart")) context_data.get("handleStart"))
handle_end = instance.data.get("handleEnd", handle_end = instance.data.get("handleEnd",
context_data.get("handleEnd")) context_data.get("handleEnd"))
duration = frame_end - frame_start + 1
frame_start_handle = frame_start - handle_start
frame_end_handle = frame_end + handle_end
duration = frame_end_handle - frame_start_handle + 1
prep_data = copy.deepcopy(instance.data["anatomyData"]) prep_data = copy.deepcopy(instance.data["anatomyData"])
if "slate.farm" in instance.data["families"]: if "slate.farm" in instance.data["families"]:
frame_start += 1 frame_start_handle += 1
duration -= 1 duration -= 1
prep_data.update({ prep_data.update({
"frame_start": frame_start, "frame_start": frame_start_handle,
"frame_end": frame_end, "frame_end": frame_end_handle,
"duration": duration, "duration": duration,
"version": int(version), "version": int(version),
"comment": instance.context.data.get("comment", ""), "comment": instance.context.data.get("comment", ""),
@ -99,13 +102,13 @@ class ExtractBurnin(pype.api.Extractor):
_prep_data["anatomy"] = filled_anatomy.get_solved() _prep_data["anatomy"] = filled_anatomy.get_solved()
# copy frame range variables # copy frame range variables
frame_start_cp = frame_start frame_start_cp = frame_start_handle
frame_end_cp = frame_end frame_end_cp = frame_end_handle
duration_cp = duration duration_cp = duration
if no_handles: if no_handles:
frame_start_cp = frame_start + handle_start frame_start_cp = frame_start
frame_end_cp = frame_end - handle_end frame_end_cp = frame_end
duration_cp = frame_end_cp - frame_start_cp + 1 duration_cp = frame_end_cp - frame_start_cp + 1
_prep_data.update({ _prep_data.update({
"frame_start": frame_start_cp, "frame_start": frame_start_cp,

View file

@ -166,30 +166,33 @@ class ExtractReview(pyblish.api.InstancePlugin):
# necessary input data # necessary input data
# adds start arg only if image sequence # adds start arg only if image sequence
frame_start_handle = frame_start - handle_start
frame_end_handle = frame_end + handle_end
if isinstance(repre["files"], list): if isinstance(repre["files"], list):
if frame_start != repre.get("detectedStart", frame_start): if frame_start_handle != repre.get("detectedStart", frame_start_handle):
frame_start = repre.get("detectedStart") frame_start_handle = repre.get("detectedStart")
# exclude handle if no handles defined # exclude handle if no handles defined
if no_handles: if no_handles:
frame_start_no_handles = frame_start + handle_start frame_start_handle = frame_start
frame_end_no_handles = frame_end - handle_end frame_end_handle = frame_end
input_args.append( input_args.append(
"-start_number {0} -framerate {1}".format( "-start_number {0} -framerate {1}".format(
frame_start, fps)) frame_start_handle, fps))
else: else:
if no_handles: if no_handles:
start_sec = float(handle_start) / fps start_sec = float(handle_start) / fps
input_args.append("-ss {:0.2f}".format(start_sec)) input_args.append("-ss {:0.2f}".format(start_sec))
frame_start_no_handles = frame_start + handle_start frame_start_handle = frame_start
frame_end_no_handles = frame_end - handle_end frame_end_handle = frame_end
input_args.append("-i {}".format(full_input_path)) input_args.append("-i {}".format(full_input_path))
for audio in instance.data.get("audio", []): for audio in instance.data.get("audio", []):
offset_frames = ( offset_frames = (
instance.data.get("startFrameReview") - instance.data.get("frameStartFtrack") -
audio["offset"] audio["offset"]
) )
offset_seconds = offset_frames / fps offset_seconds = offset_frames / fps
@ -264,10 +267,8 @@ class ExtractReview(pyblish.api.InstancePlugin):
output_args.append("-shortest") output_args.append("-shortest")
if no_handles: if no_handles:
duration_sec = float( duration_sec = float(frame_end_handle - frame_start_handle + 1) / fps
(frame_end - (
frame_start + handle_start
) + 1) - handle_end) / fps
output_args.append("-t {:0.2f}".format(duration_sec)) output_args.append("-t {:0.2f}".format(duration_sec))
# output filename # output filename
@ -383,7 +384,9 @@ class ExtractReview(pyblish.api.InstancePlugin):
"codec": codec_args, "codec": codec_args,
"_profile": profile, "_profile": profile,
"resolutionHeight": resolution_height, "resolutionHeight": resolution_height,
"resolutionWidth": resolution_width "resolutionWidth": resolution_width,
"frameStartFtrack": frame_start_handle,
"frameEndFtrack": frame_end_handle
}) })
if is_sequence: if is_sequence:
repre_new.update({ repre_new.update({
@ -393,8 +396,8 @@ class ExtractReview(pyblish.api.InstancePlugin):
if no_handles: if no_handles:
repre_new.update({ repre_new.update({
"outputName": name + "_noHandles", "outputName": name + "_noHandles",
"startFrameReview": frame_start_no_handles, "frameStartFtrack": frame_start,
"endFrameReview": frame_end_no_handles "frameEndFtrack": frame_end
}) })
if repre_new.get('preview'): if repre_new.get('preview'):
repre_new.pop("preview") repre_new.pop("preview")