mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
Merge branch 'develop' into feature/PYPE-92-pr-basic-pipeline-linking
This commit is contained in:
commit
f6caee4c43
2 changed files with 38 additions and 10 deletions
|
|
@ -10,7 +10,7 @@ import toml
|
|||
from avalon import io, lib, pipeline
|
||||
from avalon import session as sess
|
||||
import acre
|
||||
|
||||
from pype.ftrack import ftrack_utils
|
||||
|
||||
from pype import api as pype
|
||||
|
||||
|
|
@ -345,15 +345,36 @@ class AppAction(object):
|
|||
}
|
||||
pass
|
||||
|
||||
|
||||
|
||||
# RUN TIMER IN FTRACK
|
||||
username = event['source']['user']['username']
|
||||
user = session.query('User where username is "{}"'.format(username)).one()
|
||||
task = session.query('Task where id is {}'.format(entity['id'])).one()
|
||||
query_user = 'User where username is "{}"'.format(username)
|
||||
query_task = 'Task where id is {}'.format(entity['id'])
|
||||
user = session.query(query_user).one()
|
||||
task = session.query(query_task).one()
|
||||
self.log.info('Starting timer for task: ' + task['name'])
|
||||
user.start_timer(task, force=True)
|
||||
|
||||
# Change status of task to In progress
|
||||
config = ftrack_utils.get_config_data()
|
||||
|
||||
if (
|
||||
'status_on_app_launch' in config and
|
||||
'sync_to_avalon' in config and
|
||||
'statuses_name_change' in config['sync_to_avalon']
|
||||
):
|
||||
statuses = config['sync_to_avalon']['statuses_name_change']
|
||||
if entity['status']['name'].lower() in statuses:
|
||||
status_name = config['status_on_app_launch']
|
||||
|
||||
try:
|
||||
query = 'Status where name is "{}"'.format(status_name)
|
||||
status = session.query(query).one()
|
||||
task['status'] = status
|
||||
session.commit()
|
||||
except Exception as e:
|
||||
msg = "Status '{}' in config wasn't found on Ftrack".format(status_name)
|
||||
self.log.warning(msg)
|
||||
|
||||
return {
|
||||
'success': True,
|
||||
'message': "Launching {0}".format(self.label)
|
||||
|
|
|
|||
|
|
@ -39,13 +39,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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue