mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-26 05:42:15 +01:00
added mapping for avalon -> ftrack id if ftrackId is not in entity's data
This commit is contained in:
parent
f44011268c
commit
d57586c76b
1 changed files with 13 additions and 3 deletions
|
|
@ -129,6 +129,7 @@ class DeleteAssetSubset(BaseAction):
|
|||
"type": "asset",
|
||||
"data.ftrackId": {"$in": ftrack_ids}
|
||||
}))
|
||||
found_without_ftrack_id = {}
|
||||
if len(selected_av_entities) != len(ftrack_ids):
|
||||
found_ftrack_ids = [
|
||||
ent["data"]["ftrackId"] for ent in selected_av_entities
|
||||
|
|
@ -156,6 +157,7 @@ class DeleteAssetSubset(BaseAction):
|
|||
# with same name does not match same ftrack id?
|
||||
if "ftrackId" not in av_ent["data"]:
|
||||
selected_av_entities.append(av_ent)
|
||||
found_without_ftrack_id[str(av_ent["_id"])] = ftrack_id
|
||||
break
|
||||
|
||||
if not selected_av_entities:
|
||||
|
|
@ -186,7 +188,8 @@ class DeleteAssetSubset(BaseAction):
|
|||
"created_at": datetime.now(),
|
||||
"project_name": project_name,
|
||||
"subset_ids_by_name": {},
|
||||
"subset_ids_by_parent": {}
|
||||
"subset_ids_by_parent": {},
|
||||
"without_ftrack_id": found_without_ftrack_id
|
||||
}
|
||||
|
||||
id_item = {
|
||||
|
|
@ -444,14 +447,21 @@ class DeleteAssetSubset(BaseAction):
|
|||
asset_ids_to_archive = []
|
||||
ftrack_ids_to_delete = []
|
||||
if len(assets_to_delete) > 0:
|
||||
map_av_ftrack_id = spec_data["without_ftrack_id"]
|
||||
# Prepare data when deleting whole avalon asset
|
||||
avalon_assets = self.dbcon.find({"type": "asset"})
|
||||
avalon_assets_by_parent = collections.defaultdict(list)
|
||||
for asset in avalon_assets:
|
||||
asset_id = asset["_id"]
|
||||
parent_id = asset["data"]["visualParent"]
|
||||
avalon_assets_by_parent[parent_id].append(asset)
|
||||
if asset["_id"] in assets_to_delete:
|
||||
ftrack_id = asset["data"]["ftrackId"]
|
||||
if asset_id in assets_to_delete:
|
||||
ftrack_id = map_av_ftrack_id.get(str(asset_id))
|
||||
if not ftrack_id:
|
||||
ftrack_id = asset["data"].get("ftrackId")
|
||||
|
||||
if not ftrack_id:
|
||||
continue
|
||||
ftrack_ids_to_delete.append(ftrack_id)
|
||||
|
||||
children_queue = Queue()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue