Hello everyone,
How to assign a hotkey (keyboard shortcut) to a python function defined inside an OTL.? I tried searching the documentation and forum regarding this but i couldnt find it out. Kindly help me out with this.
Thanks a lot in advance.
Assigning Custom hotkey to a python function
7438 5 0- Raavenish
- Member
- 52 posts
- Joined: 6月 2009
- Offline
- graham
- Member
- 1921 posts
- Joined: 11月 2006
- Offline
You can't map a hotkey directly to a function. You need some sort of tool/action. Your best bet would be to create a tool that calls your Python function and then you can assign a hotkey to that particular tool.
http://www.sidefx.com/docs/houdini11.0/ref/windows/edittool [sidefx.com]
http://www.sidefx.com/docs/houdini11.0/ref/windows/hotkey [sidefx.com]
http://www.sidefx.com/docs/houdini11.0/ref/windows/edittool [sidefx.com]
http://www.sidefx.com/docs/houdini11.0/ref/windows/hotkey [sidefx.com]
Graham Thompson, Technical Artist @ Rockstar Games
- Raavenish
- Member
- 52 posts
- Joined: 6月 2009
- Offline
- Raavenish
- Member
- 52 posts
- Joined: 6月 2009
- Offline
- graham
- Member
- 1921 posts
- Joined: 11月 2006
- Offline
Unfortunately hotkey data can't be stored with assets. Hotkey data is stored in a file called HotkeyOverrides which is saved somewhere in your Houdini path, usual your $HOME/houdiniX.Y directory. Even if you create another tool attached to your digital asset and assign a hotkey through the Type Properties you will only get that hotkey available on your user/machine you created it on. The moment someone else loads that asset it won't have a hotkey associated with it.
You could consider writing a OnLoaded handler for your digital asset and in there, use hou.findFile() to look for the HotkeyOverrides file and append the necessary override code into that file if it isn't already in there. However the hotkey added with that method will work until the next time you launch Houdini because Houdini doesn't refresh its hotkey list.
You could consider writing a OnLoaded handler for your digital asset and in there, use hou.findFile() to look for the HotkeyOverrides file and append the necessary override code into that file if it isn't already in there. However the hotkey added with that method will work until the next time you launch Houdini because Houdini doesn't refresh its hotkey list.
Graham Thompson, Technical Artist @ Rockstar Games
- Andr
- Member
- 899 posts
- Joined: 2月 2016
- Offline
-
- Quick Links