top of page
  • Writer's pictureKevfx Studios

Houdini Python - UI

Updated: Sep 21, 2022

Sometimes, TDs need to access the UI elements to set up tools etc. So there you go. Here are my some example tips and tricks.

(This post will be updated. Keep checking this space out.)


Shelf and Tool

Here is some example code for getting shelves and shelf tools.

  • How to get desktop?

desk = hou.ui.curDesktop()
  • How to get shelf dock?

shelf_dock = desk.shelfDock()
  • How to get shelf sets?

shelf_sets = shelf_dock.shelfSets()
  • How to get shelves of the first shelf set?

shelves = shelf_sets[0].shelves()
  • How to get the name of a shelf?

  • How to create a new shelf?

hou.shelves.newShelf(name="myshelf", label="My Shelf")


Radio Buttons Folders

Note that when you have a few folders working together as Radio Buttons folders, and you want to know which one is currently active, you need to access it through a name that is first folder name plus "1".

E.g. if your first Radio Buttons folder is "the_radio_button_grp" (the other Radio Buttons folders' names do not matter), then somehow internally Houdini will rename it "the_radio_button_grp1".


Button Strip

When querying a Button Strip parameter's value, we will get bitfield. Bitfield has higher bits on the left, say decimal 5 is 0101. But note, Houdini button strip order is reversed. So value 5 (0101) means on, off, on, off (if you have 4 buttons) with lower bit corresponding to the button on the left.

So to know if the nth button is on, use value & (1 << n). This will do a bit AND operation between the value and the bit mask (with 1 left-shifted by n in the bitfield).

Similarly, use OR operation to set a button on with a bit mask. And use XOR operation to toggle a button with a bit mask.


  • Say there is a button strip parameter with 6 buttons. And the 'Menu' setting for this parameter is 'Toggle(Field + Multiple Selection Menu)'. So it allows multiple selections.

  • Get the parameter object

>>> p = hou.parm('/obj/geo1/myassset/views')
  • If no button is on, the parameter will eval as

>>> p.eval()
  • If first button is on, the parameter will eval as

>>> p.eval()
  • If both first two button are on, then 3. Why 3? Because bitfield 11 is 3.

>>> p.eval()
  • How to know if the 4th button is on? Note: the index of 4th button is 3.


32 views0 comments

Recent Posts

See All


bottom of page