Grouping Actions
0

4 posts in this topic

Hey there! I'm hoping to get an example/explanation of this Tip on https://help.ftrack.com/developing-with-ftrack/key-concepts/actions

Quote

Tip
To group actions together, give them the same label and specify a unique variant per action.

I input the same label and set the "variant" attribute on 2 of my actions to different strings, but there are still 2 icons appearing, labeled with the same name. What is the actual outcome of this when done correctly? Is there an example you can provide so I can troubleshoot what I'm doing wrong?

Thanks!

Share this post


Link to post
Share on other sites

Hi Kristing ! 

I've been looking now at the example you posted, and looks like it's missing something in order to cope with what you are after.
Here how I got it working.

In:  ~/.local/ftrack-connect-plugins/testactions/hook

* first.py
* second.py

each of these files contains a copy of the linked example.

Here is how the classes are initialised:

class MyCustomAction(object):
'''Custom action.'''
 
label = 'My Action'
identifier = 'my.custom.action'
description = 'This is an example action'
variant = 'first'

 

class MyCustomAction(object):
'''Custom action.'''
 
label = 'My Action'
identifier = 'my.custom.action'
description = 'This is an example action'
variant = 'second'

Then change in (both) the discover function to include the variant :  

return {
'items': [{
'label': self.label,
'description': self.description,
'actionIdentifier': self.identifier,
'variant': self.variant
}]
}

rather than : 

return {
'items': [{
'label': self.label,
'description': self.description,
'actionIdentifier': self.identifier,
}]
}

If you then restart connect , this is how the action should show up:

Screenshot from 2018-06-20 09-55-06.png

 

To simplify further though, I would also suggest you to have a look at : https://bitbucket.org/ftrack/ftrack-action-handler
Which aims to simplify the implementation of custom actions (http://ftrack-action-handler.rtd.ftrack.com/en/stable/).

Please let me know if you have any further issue or questions.
Cheers.
L.

 

 

 

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
0