Default asset
1 1

2 posts in this topic

I was wondering if its feasible to create a default asset that will be loaded by the Launch Maya Action?

 

For example:  a user chooses the Maya Action from ftrack-connect and it launches Maya, but there is no asset on disk, so we'd need to create a default .mb file with something in it.

 

After poking around the docs and ftrack-connect code, I'm thinking that perhaps the best way to achieve this would be to issue an event, for example, "my-custom-event". I'd have an event listener for this event and the handler could script the generation of the .mb file?

Share this post


Link to post
Share on other sites

Hi,

You could use something like this to find out whether a Maya file had ever been published for a given task. If not, this will raise a NoResultFoundError, so maybe you want to use all() and check the length instead.

components = session.query('Component where version.task_id is "{0}" and file_type in'

'(".ma", ".mb")'.format(

task_id)).one()

If you already have a Maya file on disk, you could publish with just the Python API:
http://ftrack.rtd.ftrack.com/en/3.3.7/developing/reviewing/publish_components_for_review.html

And maybe you want to modify ftrack_connect_maya_hook.py so that the publish happens before Maya even starts.
Otherwise you could modify userSetup.py to load your default file and optionally publish it to the current Task.

/Johan

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
1 1