mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
Merge pull request #4343 from Tilix4/ft_keep_hero_repres_uptodate
Feature: Keep synced hero representations up-to-date.
This commit is contained in:
commit
042fd998fd
1 changed files with 19 additions and 0 deletions
|
|
@ -386,6 +386,25 @@ class IntegrateHeroVersion(pyblish.api.InstancePlugin):
|
|||
repre["_id"] = old_repre["_id"]
|
||||
update_data = prepare_representation_update_data(
|
||||
old_repre, repre)
|
||||
|
||||
# Keep previously synchronized sites up-to-date
|
||||
# by comparing old and new sites and adding old sites
|
||||
# if missing in new ones
|
||||
old_repre_files_sites = [
|
||||
f.get("sites", []) for f in old_repre.get("files", [])
|
||||
]
|
||||
for i, file in enumerate(repre.get("files", [])):
|
||||
repre_sites_names = {
|
||||
s["name"] for s in file.get("sites", [])
|
||||
}
|
||||
for site in old_repre_files_sites[i]:
|
||||
if site["name"] not in repre_sites_names:
|
||||
# Pop the date to tag for sync
|
||||
site.pop("created_dt", None)
|
||||
file["sites"].append(site)
|
||||
|
||||
update_data["files"][i] = file
|
||||
|
||||
op_session.update_entity(
|
||||
project_name,
|
||||
old_repre["type"],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue