From 668eb24969102874a7df0907c12a057b7f2f437e Mon Sep 17 00:00:00 2001 From: Jakub Trllo Date: Mon, 7 Jan 2019 17:38:50 +0100 Subject: [PATCH] added hierarchical check for custom attrbiutes --- pype/ftrack/ftrack_utils.py | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/pype/ftrack/ftrack_utils.py b/pype/ftrack/ftrack_utils.py index caaeb6c707..7038c0adf8 100644 --- a/pype/ftrack/ftrack_utils.py +++ b/pype/ftrack/ftrack_utils.py @@ -13,6 +13,7 @@ from app.api import Logger log = Logger.getLogger(__name__) + def get_data(parent, entity, session, custom_attributes): entity_type = entity.entity_type @@ -22,13 +23,20 @@ def get_data(parent, entity, session, custom_attributes): for cust_attr in custom_attributes: key = cust_attr['key'] - if cust_attr['entity_type'].lower() in ['asset']: + if ( + cust_attr['is_hierarchical'] is True or + cust_attr['entity_type'].lower() in ['asset'] or + ( + cust_attr['entity_type'].lower() in ['show'] and + entity_type.lower() == 'project' + ) + ): data[key] = entity['custom_attributes'][key] - elif cust_attr['entity_type'].lower() in ['show'] and entity_type.lower() == 'project': - data[key] = entity['custom_attributes'][key] - - elif cust_attr['entity_type'].lower() in ['task'] and entity_type.lower() != 'project': + elif ( + cust_attr['entity_type'].lower() in ['task'] and + entity_type.lower() != 'project' + ): # Put space between capitals (e.g. 'AssetBuild' -> 'Asset Build') entity_type_full = re.sub(r"(\w)([A-Z])", r"\1 \2", entity_type) # Get object id of entity type