Jump to content

Filtering actions discovered

Recommended Posts

So I have custom actions for launching maya/nuke aso and I want to filter when these actions are displayed and how.

1. I only want an action to be discovered if a task is selected, not proj/seq/shot. 
The problem is that the event['data'] type based on selection returns "task" for both task/shot and sequences so I can't filter based on that.
I'm currently getting the ['object_type']['name'] for the typedContext based on the entityId and checking if it's "Task" but this forces a session query per action which is slow.
Is there a better/faster way of doing this?

2. I want to filter the applications based on a custom attribute.
Our projects/sq/sh/task have a custom hierarchical attribute called "application_maya" where we can specify which version of maya should be used and I want to only show that variant as an option upon discovery.
At the moment I have to query the custom attribute on the task/sq/sh and proj, ie parent chain, in order to get that value and then ignore variants that doesn't match the attribute.
This works but yet again is really slow as there's a big session query for each action.
Is there a better/faster way of doing this?


Link to comment
Share on other sites

Hi @AlexOddbratt, overall your approach seems right.
For general actions though, I'd suggest having a looking into our helper class  in there you can find a helper function that might help you out narrowing down the entity type you are after.

For what concerns custom attributes I'd suggest having a look a the query projections as might be a good way to speed it up.

Hope it helps.

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