YuChen Posted December 2, 2021 Report Share Posted December 2, 2021 Hi all,http://ftrack-connect.rtd.ftrack.com/en/stable/developing/tutorial/custom_applications.html I'm working on a custom application launcher mention in above link and noticed that "_getApplicationEnvironment" seems like not provide correct entity type for selected enity (in ftrack studio Web page). When I query entity type like this: def _getApplicationEnvironment(self, application, context=None): ... if context['selection']: entity_id = context['selection'][0]['entityId'] # entity ID is connect entity_type = context['selection'][0]['entityType'] # but entity type always return "task" I always got "task" for entity type. Should't it be the type corresponding to my selection Link to comment Share on other sites More sharing options...
Lorenzo Angeli Posted December 3, 2021 Report Share Posted December 3, 2021 Hi @YuChen in order to build the entity , you can try doing the following. my_selection = self.session.get( context['selection'][0]['entityType'], context['selection'][0]['entityId'] ) hope it helps. L. Link to comment Share on other sites More sharing options...
YuChen Posted January 19, 2022 Author Report Share Posted January 19, 2022 Hi @Lorenzo Angeli Since "context['selection'][0]['entityType']" always gives out "task" string (only "assetversion" and "show" can be correctly recognized), the command you provided doesn't really work (test with ftrack-connect-package-1.1.2 & ftrack-connect-2.0.0 rc3). I think maybe some fixing are necessary forthis issue: 1. "context['selection'][0]['entityType']" need to provide correct selected entity type. 2. "context['selection'][0]['entityType']" need to provide a string started with capital letter. Now the "context['selection'][0]['entityType']" gives "task" which is started with lowercase alphabet and it can't be used directly in "session.get" function: my_selection = self.session.get( 'task', 'task_id' ) # This doesn't work my_selection = self.session.get( 'Task', 'task_id' ) # This works Not sure whether it's a bug or not but I guess these fixing could make workflow more fluent Link to comment Share on other sites More sharing options...
Lorenzo Angeli Posted January 19, 2022 Report Share Posted January 19, 2022 HI @YuChen, yes you are right. context['selection'][0]['entityType'] returns a lowercase type where you need an upper case.here you can see how we are handling it in our action handler source code. Hope it helps. L. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now