Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Kitsu: 2 fixes, nb_frames and Shot type error #3940

Merged
merged 3 commits into from
Oct 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions openpype/modules/kitsu/utils/update_op_with_zou.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ def update_op_assets(
item_data["frameStart"] = frame_in
# Frames duration, fallback on 0
try:
frames_duration = int(item_data.pop("nb_frames", 0))
# NOTE nb_frames is stored directly in item
# because of zou's legacy design
frames_duration = int(item.get("nb_frames", 0))
except (TypeError, ValueError):
frames_duration = 0
# Frame out, fallback on frame_in + duration or project's value or 1001
Expand Down Expand Up @@ -170,7 +172,7 @@ def update_op_assets(
# Substitute item type for general classification (assets or shots)
if item_type in ["Asset", "AssetType"]:
entity_root_asset_name = "Assets"
elif item_type in ["Episode", "Sequence"]:
elif item_type in ["Episode", "Sequence", "Shot"]:
entity_root_asset_name = "Shots"

# Root parent folder if exist
Expand Down Expand Up @@ -276,11 +278,13 @@ def write_project_to_op(project: dict, dbcon: AvalonMongoDB) -> UpdateOne:

match_res = re.match(r"(\d+)x(\d+)", project["resolution"])
if match_res:
project_data['resolutionWidth'] = int(match_res.group(1))
project_data['resolutionHeight'] = int(match_res.group(2))
project_data["resolutionWidth"] = int(match_res.group(1))
project_data["resolutionHeight"] = int(match_res.group(2))
else:
log.warning(f"\'{project['resolution']}\' does not match the expected"
" format for the resolution, for example: 1920x1080")
log.warning(
f"'{project['resolution']}' does not match the expected"
" format for the resolution, for example: 1920x1080"
)

return UpdateOne(
{"_id": project_doc["_id"]},
Expand Down