From a0f6e017f9b4dc12c3ee097bfa5451d97df7a7e1 Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Mon, 3 Dec 2018 12:47:24 +0100 Subject: [PATCH] Added few words --- pype/ftrack/actions/action_syncToAvalon.py | 26 +++++++++++++++++++++- pype/ftrack/ftrack_utils.py | 5 ----- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/pype/ftrack/actions/action_syncToAvalon.py b/pype/ftrack/actions/action_syncToAvalon.py index 596b7362f9..556c57be2a 100644 --- a/pype/ftrack/actions/action_syncToAvalon.py +++ b/pype/ftrack/actions/action_syncToAvalon.py @@ -18,7 +18,28 @@ class SyncToAvalon(BaseAction): ''' Synchronizing data action - from Ftrack to Avalon DB + Stores all information about entity. + - Name(string) - Most important information + - Parent(ObjectId) - Avalon Project Id, if entity is not project itself + - Silo(string) - Last parent except project + - Data(dictionary): + - VisualParent(ObjectId) - Avalon Id of parent asset + - Parents(array of string) - All parent names except project + - Tasks(array of string) - Tasks on asset + - FtrackId(string) + - entityType(string) - entity's type on Ftrack + * All Custom attributes in group 'Avalon' which name don't start with 'avalon_' + These information are stored also for all parents and children entities. + + Avalon ID of asset is stored to Ftrack -> Custom attribute 'avalon_mongo_id'. + - action IS NOT creating this Custom attribute if doesn't exist + - run 'Create Custom Attributes' action or do it manually (Must be in 'avalon' group) + + If Ftrack entity already has Custom Attribute 'avalon_mongo_id' that stores ID: + - names are checked -> shows error if names are not exact the same!!! + - after sync is not allowed to change names! + - only way is to create new entity in ftrack with new name ''' @@ -206,7 +227,10 @@ class SyncToAvalon(BaseAction): # Presets: data = ftrack_utils.get_data(self, entity, session, self.custom_attributes) - silo = data.pop('silo') + silo = entity['name'] + if len(data['parents']) > 0: + silo = data['parents'][0] + os.environ['AVALON_SILO'] = silo name = entity['name'] diff --git a/pype/ftrack/ftrack_utils.py b/pype/ftrack/ftrack_utils.py index ab13c8c63b..68c9be6bfb 100644 --- a/pype/ftrack/ftrack_utils.py +++ b/pype/ftrack/ftrack_utils.py @@ -53,10 +53,6 @@ def get_data(parent, entity, session, custom_attributes): tmp = session.get(entity['link'][i]['type'], entity['link'][i]['id']) parents.append(tmp) - silo = entity['name'] - if len(parents) > 0: - silo = parents[0]['name'] - folderStruct = [] parentId = None @@ -70,7 +66,6 @@ def get_data(parent, entity, session, custom_attributes): hierarchy = os.path.sep.join(folderStruct) - data['silo'] = silo data['visualParent'] = parentId data['parents'] = folderStruct data['tasks'] = tasks