Hi everyone, simple question here, I wanted to know if I can add actions to the context menu (right+click) in some of the apps via hooks instead of having to modify the app package itself.
I possibly need different actions for different projects, and want to avoid a duplicate of the app packages for each project.
When we need to open a publish file with the tk-multi-workfiles2, we want to choose if we really want to open that file or a relative workfile instead.
To do that we want to add an action in the context menu to choose between both options.
And I was wondering if there’s a hook to do it or if we have to modify the app code to add an action in the context menu (right cliking menu) on a published file in tk-multi-workfiles2.
You can add custom actions to the context menu when you right click on a file in workfiles.
You should be able to do this by taking over the custom_actions hook. Annoyingly though we don’t appear to have any documentation on that, other than the comments in the default hook code.
And unfortunately, I don’t have the time right now to write up a detailed explanation on how to use it, but maybe that is enough to put you on the right path? If not let me know and I’ll try and find some time to write something up.
Hi everybody, I tested the custom_actions hook and that’s exactly what I need.
But, it’s a bit wired, if I change the hook in the app package, everything works fine.
But if I use an hook file from elsewhere (editing the settings to point to that file), it works when no scene is opened. But as soon as I open a scene, my custom_actions are not available anymore in the Open UI.
Test 01
Edit custom_actions.py in tk-multi-workfiles2
Launch Houdini
Launch the Open UI
Custom actions are available
Open a file
Relaunch the Open UI
Custom actions are still available
Test 02
Add edited custom_actions in tk_config/config/core/hooks/tk-multi-workfiles2
Edit tk-multi-workfiles2.yml setting file and make the custom_actions_hook setting to point to that file
Hey Tristan, without looking at the code I think I know whats at play here.
When you open a scene the context changes from “project” to “shot” or “asset” and if your app/custom actions hook is not configured in that environment it will not be loaded.
Make sure you add the hook settings to each of the environements you want the actions to appear:
Yeah I didn’t either at the beginning but basically each app kind of reloads when the context switches. (Or unloads if it’s not needed in that context, like the nuke writenodes)