Custom Main Menus in Houdini

As you get more comfortable with Houdini, you will most likely gravitate to using the Technical Desktop layout. I use this layout with some slight tweaks. However, I still jump to other layouts all the time depending on the task I’m doing.

Now, what is slightly annoying is having to navigate to the Desktop submenu located under the Windows menu. Way too many turns.

Houdini Technical Desktop
Houdini Technical Desktop

It would be nice if you could customize this wouldn’t it? Well, we’re talking about Houdini here! Of course you can customize it! Not only that, you can add, create new menus, and add custom functionality to these menus. It gets a bit involved, so we’ll stick to the basics for this one.

Configuration Files

Houdini uses XML configuration files to customize not only the main menu but various node context menus. You can add, remove and rearrange menus by modifying these XML files.

The way this works is Houdini first loads a default menu file located in your $HFS path, then it looks for a similar file with the same name under your $HOUDINI_PATH. Recall $HOUDIN_PATH is the path of directories where Houdini looks for configuration files. I use my $HOUDINI_USER_PREF_DIR for this type of stuff.

So, if Houdini finds the file by the same name, it appends or modifies the definitions from files loaded earlier in the path. This is similar to adding custom behavior to nodes or for the UNIX folks, how bash profiles work.

The XML file’s name in question is important. This file is called MainMenuCommon.xml. I feel a need to give you a bit of a warning. Configuring these files, while not super difficult, can be tricky especially, if you have never dealt with XML schemas. Luckily for us, Side Effects provides a sample XML file with various ways to customize the menus. We will make use of this by copying and pasting some tag elements from this file to our custom MainMenuCommon.xml file.

The Magic

First thing we want to do is open the file ExampleFile.xml located in your $HFS path. On the Mac, this will be /Library/Frameworks/Houdini.framework/Versions/15.0.244.16/Resources/houdini/ExampleMenu.xml

Custom Menu Example File
Custom Menu Example File

Open the file up and you will see a well commented configuration file explaining various ways to modify the menus. You can actually drop this file in your $HOUDINI_PATH, renaming it to MainMenuCommon.xml and see it in action. This will also help you visualize how the various tag elements will affect the main menu. This does not happen dynamically, you need to restart Houdini for the changes to take effect.

Now, create a new file named MainMenuCommon.xml. Remember, the name is important. It must be exactly as written. Save this file to the root level of your $HOUDINI_USER_PREF_DIR a.k.a preferences directory. Have this file open alongside the ExampleMenu.xml because we are going to paste some tag elements into it.

MainMenuCommon.xml File
MainMenuCommon.xml File

We want to add some information to our MainMenuCommon.xml file first. You are going to include the following tags in the file:

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

<mainMenu>
 <menuBar>

 </menuBar>
</mainMenu>

The first line is adding an XML declaration. Then we are opening and closing <mainMenu> and <menuBar> tags. We are going to paste some code from our example file between the <menuBar> tags so leave some space in between.

In your ExampleMenu.xml, scroll all the way to the bottom at around line 252. Copy the lines 256 thru 260. The lines in question begin with the tag <subMenu> and end with <removeItem id=“window_menu_sep_0″/>

<!-- An example of how to move the Desktop submenu out of the Windows menu and directly into the menu bar (using partial submenu redefinition). -->

 <menuBar>
   <subMenu id="desktop_submenu">
     <insertBefore>help_menu</insertBefore>
   </subMenu>
 </menuBar>
 <removeItem id="windows_menu_sep_0"/>

I’m not going to get into the language involved for defining these files so I’ll leave it to the reader to do her/his research. The Houdini documentation has a great section on working with these XML configuration files.

Once, you have that section of code on your pasteboard, move over to the MainMenuCommon.xml file and paste in between the <menuBar> tags. You should have something like the following:

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

<mainMenu>
  <menuBar>
  <!-- ========================= DESKTOPS Menu ========================= -->
    <subMenu id="desktop_submenu">
      <insertBefore>help_menu</insertBefore>
    </subMenu>
    <removeItem id="windows_menu_sep_0"/>

  </menuBar>
</mainMenu>

customMenus04

I added the DESKTOPS Menu comment since I like comments. Especially if I begin to tack on more information. Save the file and restart or open Houdini. You should really have Houdini closed when doing this but my computer hasn’t blown up yet so it can’t be all that bad. If all went according to plan, you should have a nice Desktop menu on your main menu bar!

menu08

Now, doesn’t that feel much better?

Share:
990adjustments

990adjustments

I am a motion designer & developer based out of South Florida. When not designing or animating pixels, I wrangle some code. If all else fails, I watch Twilight Zone, I Love Lucy, or Three's Company reruns.