mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-25 05:14:40 +01:00
fill missing 'ftrackId' key on project if is not available
This commit is contained in:
parent
74257d5ae0
commit
91b30c1f10
1 changed files with 13 additions and 1 deletions
|
|
@ -193,7 +193,9 @@ class SyncToAvalonEvent(BaseEvent):
|
|||
self._avalon_ents_by_ftrack_id = {}
|
||||
proj, ents = self.avalon_entities
|
||||
if proj:
|
||||
ftrack_id = proj["data"]["ftrackId"]
|
||||
ftrack_id = proj["data"].get("ftrackId")
|
||||
if ftrack_id is None:
|
||||
ftrack_id = self._update_project_ftrack_id()
|
||||
self._avalon_ents_by_ftrack_id[ftrack_id] = proj
|
||||
for ent in ents:
|
||||
ftrack_id = ent["data"].get("ftrackId")
|
||||
|
|
@ -202,6 +204,16 @@ class SyncToAvalonEvent(BaseEvent):
|
|||
self._avalon_ents_by_ftrack_id[ftrack_id] = ent
|
||||
return self._avalon_ents_by_ftrack_id
|
||||
|
||||
def _update_project_ftrack_id(self):
|
||||
ftrack_id = self.cur_project["id"]
|
||||
|
||||
self.dbcon.update_one(
|
||||
{"type": "project"},
|
||||
{"$set": {"data.ftrackId": ftrack_id}}
|
||||
)
|
||||
|
||||
return ftrack_id
|
||||
|
||||
@property
|
||||
def avalon_subsets_by_parents(self):
|
||||
if self._avalon_subsets_by_parents is None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue