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"))
handle_end = instance.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"])
if "slate.farm" in instance.data["families"]:
frame_start += 1
frame_start_handle += 1
duration -= 1
prep_data.update({
"frame_start": frame_start,
"frame_end": frame_end,
"frame_start": frame_start_handle,
"frame_end": frame_end_handle,
"duration": duration,
"version": int(version),
"comment": instance.context.data.get("comment", ""),
@ -99,13 +102,13 @@ class ExtractBurnin(pype.api.Extractor):
_prep_data["anatomy"] = filled_anatomy.get_solved()
# copy frame range variables
frame_start_cp = frame_start
frame_end_cp = frame_end
frame_start_cp = frame_start_handle
frame_end_cp = frame_end_handle
duration_cp = duration
if no_handles:
frame_start_cp = frame_start + handle_start
frame_end_cp = frame_end - handle_end
frame_start_cp = frame_start
frame_end_cp = frame_end
duration_cp = frame_end_cp - frame_start_cp + 1
_prep_data.update({
"frame_start": frame_start_cp,

View file

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