natalia Posted May 16, 2022 Share Posted May 16, 2022 Hey Everyone has anyone used hou.hotkeys ? I've made a tool and would like to have a shortcut assigned to it when its loaded. I can create a shelf and add tools to it through python with the hou.shelves library. But assigning a shortcut to the tool is . I tried to understand how the shortcut was assigned to the tool by doing it manually. For example Ctrl + Alt + Shift + T to the tool called My Custom Tool Then I was curious to find what the hotkey symbol the tool was using hou.hotkeys.hotkeySymbol. The examples of the documentation show a strict dot notation but running this command will return something along these lines with a colon ? >>> hou.hotkeys.hotkeySymbol("Houdini/My Custom Tool") h.tools:my_custom_tool Regardless, with that info, trying to assign this through python seemed to work. The edit tool window will register and show the assignment, as well as the HotKey Manager. However pressing the shortcut doesn't work and doesn't trigger the tool code hou.hotkeys.addCommand("h.tool:my_custom_tool","My Custom Tool", "This is a custom tool") hou.hotkeys.addAssignment("h.tool:my_custom_tool","Alt+Ctrl+Shift+T") Weird behaviour is deleting the shortcut in the Hotkey manager and reassigning it doesn't work either. I need to manually run hou.hotkeys.removeHotkeySymbol("h.tool:my_custom_tool") for it to work again when setting it through the Hotkey Editor manually. It seems the hou.hotkeys.addCommand is missing something ? its not linking to the command to the tool correctly to the shortcut even though visually in the Hotkey editor and the edit tool window hotkeys tab shows properly. Did anyone face this issue ? Is this how we assign hotkeys to a tool through python ? Quote Link to comment Share on other sites More sharing options...
gemini Posted June 13, 2023 Share Posted June 13, 2023 Hi, I bumped into it. Have you had any solution for it now ? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.