Environment Consistency
2 2

2 posts in this topic

Hi

I'm trying to build tools that work around the context given in a certain application, such as nuke. 

The Issue that I have is that the current connect launch application actions don't provide a consistent context environment.

For example nuke and maya, provides FTRACK_TASKID, FTRACK_SHOTID among other keys (I would consider not context based).

But Nuke Studio doesn't provide any keys that are context based.

It seems connect actions are designed to only provide the information that they feel is applicable to the ftrack tools running in the application, and with no consideration for requirements of other tools being written by 3rd parties.

It would be nice if for example there was a "FTRACK_ENTITY" = "[TYPE];[ID]" sort of environment variable in every connect application, so that who ever is producing tools, could use it how they wish, and always be reliant on that variable existing. This would then free us up to make tools that weren't reliant on a Shot based work flow for example it could be any custom entity type then instead.

I'm new to ftrack and come from a shotgun pipeline. I appreciate I don't have a full understanding of how things should work in ftrack, but I'm used to being able to launch an application in what ever context and then having my tools run off that. I also realise that I could write\modify the existing actions provided by ftrack, but that's not desirable due to updates and deployment of the code.

Could this sort of thing be implemented or is there a different more preferred approach which I'm unaware of?

Thanks

Phil

Share this post


Link to post
Share on other sites

Hi Philip,

Thank you for the feedback - it totally makes sense and is something we will take with us. We're in process of revising our integrations and this is something we will think about when moving forward with those.

Meanwhile there is a solution that is not really well documented but should work. There is a FTRACK_CONNECT_EVENT environment variable that contains the encoded event that was used to launch the application from Connect. If you decode it you can find out what context was used to launch the application (Nuke, Maya, Nuke studio, etc.):

import os
import json
import base64

connect_event = json.loads(
    base64.b64decode(os.environ['FTRACK_CONNECT_EVENT'])
)
print connect_event
# Result: {u'selection': [{u'entityId': u'2717ba98-8f01-11e1-ad00-f23c91df25eb', u'entityType': u'task'}], u'description': None, u'applicationIdentifier': u'nukex_9.0v7', u'variant': u'9.0v7', u'label': u'NukeX', u'source': {u'id': u'0efdc4c3a2684a348b18968f88be005c', u'user': {u'username': u'mattias.lagergren'}}, u'actionIdentifier': u'ftrack-connect-launch-nuke', u'icon': u'nukex'}

As you can see there is a "selection" in the connect_event dictionary. The selection is a list, but when launching an application it should only contain one item. As you can see the entityType is 'task', this is for legacy reasons and most often it is safe to do (give that you're using the new api):

# foo is now a shot, task, asset build or project. Anything that inherits from Context
foo = session.get('Context', connect_event['selection'][0]['entityId'])

Let me know how this works out for you

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
2 2