Remus Avram Posted September 13, 2016 Report Share Posted September 13, 2016 I am running a action on a sequence, shot, task and I get for all 'task' entity type. How can I get the right entity type using the ftrack_api in an action? def launch(self, event): ''' @param event: ftrack event ''' user_id = event['source'].get('user', {}).get('id', None) data = event['data'] selection = data.get('selection', []) entity_type = selection[0]['entityType'] entity_id = selection[0]['entityId'] print entity_type Link to comment Share on other sites More sharing options...
Mattias Lagergren Posted September 14, 2016 Report Share Posted September 14, 2016 I think the easiest solution may be to get the TypedContext (shot, sequence, task, etc.) from the id if it is a 'task': entity = session.get('TypedContext', entity_id) TypedContext is the common base-class, but you will get the correct subclass after the query. Link to comment Share on other sites More sharing options...
Remus Avram Posted September 14, 2016 Author Report Share Posted September 14, 2016 Thanks for the answer! This is what I was looking for. Link to comment Share on other sites More sharing options...
Remus Avram Posted September 14, 2016 Author Report Share Posted September 14, 2016 How can I get the entity in the ftrack_api if the ftrack type is tempdata? Example: legacy api: temp = ftrack.TempData(id='becd972a-7a77-11e6-be67-005056a76761') I tried this in the ftrack_api: entity = session.get('TypedContext', "becd972a-7a77-11e6-be67-005056a76761") but it returns None. Thanks for the support! Link to comment Share on other sites More sharing options...
Mattias Lagergren Posted September 15, 2016 Report Share Posted September 15, 2016 Hey Remus, So TypedContext is only for the object types that you configure in Systems Settings > Workflows > Objects. Unfortunately the temp data is not available in the new api. Are you able to work around this by using the legacy api? Link to comment Share on other sites More sharing options...
Remus Avram Posted September 15, 2016 Author Report Share Posted September 15, 2016 Hi Mattias, thanks for the answer! Yes, we can find a work around for this. It would be awesome for the feature if we can get any type of entity having only the id. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.