Fixed 1 extra frame at frameEnd

Same as #4466
This commit is contained in:
Jacob Danell 2023-02-16 15:11:07 +01:00 committed by Milan Kolar
parent 1045ee0c1e
commit ef698b4afa
2 changed files with 6 additions and 5 deletions

View file

@ -111,18 +111,18 @@ def update_op_assets(
except (TypeError, ValueError):
frame_in = 1001
item_data["frameStart"] = frame_in
# Frames duration, fallback on 0
# Frames duration, fallback on 1
try:
# NOTE nb_frames is stored directly in item
# because of zou's legacy design
frames_duration = int(item.get("nb_frames", 0))
frames_duration = int(item.get("nb_frames", 1))
except (TypeError, ValueError):
frames_duration = None
# Frame out, fallback on frame_in + duration or project's value or 1001
frame_out = item_data.pop("frame_out", None)
if not frame_out:
if frames_duration:
frame_out = frame_in + frames_duration
frame_out = frame_in + frames_duration - 1
else:
frame_out = project_doc["data"].get("frameEnd", 1001)
item_data["frameEnd"] = frame_out

View file

@ -174,7 +174,8 @@ def sync_zou_from_op_project(
doc["name"],
frame_in=doc["data"]["frameStart"],
frame_out=doc["data"]["frameEnd"],
nb_frames=doc["data"]["frameEnd"] - doc["data"]["frameStart"],
nb_frames=(
doc["data"]["frameEnd"] - doc["data"]["frameStart"] + 1),
)
elif match.group(2): # Sequence
@ -229,7 +230,7 @@ def sync_zou_from_op_project(
"frame_in": frame_in,
"frame_out": frame_out,
},
"nb_frames": frame_out - frame_in,
"nb_frames": frame_out - frame_in + 1,
}
)
entity = gazu.raw.update("entities", zou_id, entity_data)