mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
Merge pull request #3887 from quadproduction/fix-kitsu-openpype-sync-without-project-resolution
This commit is contained in:
commit
34d65f9ef4
1 changed files with 13 additions and 5 deletions
|
|
@ -21,6 +21,9 @@ from openpype.pipeline import AvalonMongoDB
|
|||
from openpype.settings import get_project_settings
|
||||
from openpype.modules.kitsu.utils.credentials import validate_credentials
|
||||
|
||||
from openpype.lib import Logger
|
||||
|
||||
log = Logger.get_logger(__name__)
|
||||
|
||||
# Accepted namin pattern for OP
|
||||
naming_pattern = re.compile("^[a-zA-Z0-9_.]*$")
|
||||
|
|
@ -230,7 +233,6 @@ def update_op_assets(
|
|||
},
|
||||
)
|
||||
)
|
||||
|
||||
return assets_with_update
|
||||
|
||||
|
||||
|
|
@ -248,7 +250,7 @@ def write_project_to_op(project: dict, dbcon: AvalonMongoDB) -> UpdateOne:
|
|||
project_name = project["name"]
|
||||
project_doc = get_project(project_name)
|
||||
if not project_doc:
|
||||
print(f"Creating project '{project_name}'")
|
||||
log.info(f"Creating project '{project_name}'")
|
||||
project_doc = create_project(project_name, project_name)
|
||||
|
||||
# Project data and tasks
|
||||
|
|
@ -268,12 +270,18 @@ def write_project_to_op(project: dict, dbcon: AvalonMongoDB) -> UpdateOne:
|
|||
{
|
||||
"code": project_code,
|
||||
"fps": float(project["fps"]),
|
||||
"resolutionWidth": int(project["resolution"].split("x")[0]),
|
||||
"resolutionHeight": int(project["resolution"].split("x")[1]),
|
||||
"zou_id": project["id"],
|
||||
}
|
||||
)
|
||||
|
||||
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))
|
||||
else:
|
||||
log.warning(f"\'{project['resolution']}\' does not match the expected"
|
||||
" format for the resolution, for example: 1920x1080")
|
||||
|
||||
return UpdateOne(
|
||||
{"_id": project_doc["_id"]},
|
||||
{
|
||||
|
|
@ -334,7 +342,7 @@ def sync_project_from_kitsu(dbcon: AvalonMongoDB, project: dict):
|
|||
if not project:
|
||||
project = gazu.project.get_project_by_name(project["name"])
|
||||
|
||||
print(f"Synchronizing {project['name']}...")
|
||||
log.info(f"Synchronizing {project['name']}...")
|
||||
|
||||
# Get all assets from zou
|
||||
all_assets = gazu.asset.all_assets_for_project(project)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue