it.fin Posted July 31, 2017 Report Share Posted July 31, 2017 Hey, So I've been playing around with the events part of the api and noticed that the entities that are propagated mostly return the "entityType" "task", even if the event (eg: rename) is performed on a Shot, Folder, Task etc... The issue I'm having with this is I need to get the entity object so I can change it based on the event, but the subsequent "session.get" method takes the specific "Task", "Shot" or the like, not the "entityType", "task". Is there a way to get the entity based purely on it's ID, and not it's type? Essentially I'm working out how to prevent renames on anything in the project hierarchy (doesn't matter what Type it is) that has an asset linked to it, but I'm not wanting to hard code the types if possible. Thanks, Mark Link to comment Share on other sites More sharing options...
Eric Hermelin Posted July 31, 2017 Report Share Posted July 31, 2017 Hi Mark, you can use TypedContext to retrieve the correct entity import ftrack_api session = ftrack_api.Session() print session.get( 'TypedContext', '04036796-635b-11e5-9931-42010af0e994)' ) #"<Task(04036796-635b-11e5-9931-42010af0e994)> print session.get( 'TypedContext', '0a202d04-f7b6-4729-ba8b-f38cde2765d7)' ) #<Shot(0a202d04-f7b6-4729-ba8b-f38cde2765d7)> cheers Eric Link to comment Share on other sites More sharing options...
it.fin Posted July 31, 2017 Author Report Share Posted July 31, 2017 Awesome. Thanks Eric. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.