Houdini Hotkey Overrides

For whatever reason, I never could find actual documentation on coding hotkey for Houdini. If you’re making a specific environment for the artist to launch Houdini with specific tools, then those hotkeys need to be mandatory, especially when you’re overriding the BIG stuff, like “Open” and “Save”.

Hotkey overrides are spread across 2 files: HotkeyOverrides and MainMenuCommon.xml. These should be located in your HoudiniPath environment variable.

MainMenuCommon.xml adds the ability to customize the main menus. Documentation for it can be found here. In the case I used it, we overrode opening a scene with our own code. You can tell it what menu to put the item in, before or after which item to place your new item, what code to launch with your new item, and (if you’re replacing an item) what item to remove. When adding an item, you give it an id, so you can add a shortcut key later.

<?xml version="1.0" encoding="UTF-8"?>

<mainMenu>
    <addScriptItem id="h.open_scene">
        <label>Open</label>
        <parent>file_menu</parent>
        <insertAfter>h.new</insertAfter>
        <scriptCode>
            <![CDATA[
from houdini_code.scene import open_scene
open_scene()
]]>
        </scriptCode>
    </addScriptItem>

    <removeItem id="h.open"/>
</mainMenu>

HotkeyOverrides adds the actual hotkeys. It is a tab delineated file. The first section is the id you created in the MainMenuCommon.xml. The second section is the label that is used in the menu. The third section is description. The rest of the sections are the key combinations you’d like to assign to that command.

h.open_scene	Open	"Open file"	Alt+O	Ctrl+O