Jump to content

Grouping Actions


kristin

Recommended Posts

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!

Link to comment
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.

 

 

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...