Fix FUS-48 loader update not offsetting correctly to its frame time upon update/switch

This commit is contained in:
Roy Nieterau 2018-07-21 14:50:58 +02:00
parent 0b7ce68571
commit 40640eb598

View file

@ -82,9 +82,13 @@ def loader_shift(loader, frame, relative=True):
comp = loader.Comp()
time = comp.TIME_UNDEFINED
if not relative:
start = loader["GlobalIn"][time]
frame -= start
old_in = loader["GlobalIn"][time]
old_out = loader["GlobalOut"][time]
if relative:
shift = frame
else:
shift = frame - old_in
# Shifting global in will try to automatically compensate for the change
# in the "ClipTimeStart" and "HoldFirstFrame" inputs, so we preserve those
@ -93,9 +97,17 @@ def loader_shift(loader, frame, relative=True):
"ClipTimeEnd",
"HoldFirstFrame",
"HoldLastFrame"]):
loader["GlobalIn"][time] = loader["GlobalIn"][time] + frame
return int(frame)
# GlobalIn cannot be set past GlobalOut or vice versa
# so we must apply them in the order of the shift.
if shift > 0:
loader["GlobalOut"][time] = old_out + shift
loader["GlobalIn"][time] = old_in + shift
else:
loader["GlobalIn"][time] = old_in + shift
loader["GlobalOut"][time] = old_out + shift
return int(shift)
class FusionLoadSequence(api.Loader):