Houdini Lock Camera To View Hotkey

November 24th 2020 08:00:56am

This video tutorial is a quick tip for creating a hotkey for the Lock Camera To View display option in Houdini. There are a few items in Houdini that do not seem to be listed in the normal Hotkey assignment panel. With the power of Python however, we can create our own. I’ll show you three simple lines of code that will do just that.

Houdini Lock Camera To View Hotkey

When choosing a hotkey, you will also need to pay attention to which keys are actually available and already used by Houdini. Thankfully there are helpful indicators, of which I found out about after recording the tutorial. I’m always learning something new. You can get the full description in the Houdini docs.

Houdini Lock Camera To View Hotkey

In this particular setup we are using Python code in a script as part of a shelf tool. We then are allowed to set a custom hotkey for that tool, thereby circumventing the limitation of the Lock Camera To View feature not being listed in the native hotkey manager. Hopefully in the near future Side Fx will add this and many others to the list.

Source Code:

#Get reference to SceneViewer
pane = hou.ui.paneTabOfType(hou.paneTabType.SceneViewer)

#Get viewport
view = pane.curViewport()

#Set lock camera to view value
view.lockCameraToView(not view.isCameraLockedToView())

Like to see more new tutorials or breakdowns of my work? Please donate and/or purchase products to help support Fendra Fx. All financial support is greatly appreciated and keeps the lights on. Spread the word too. Tell your friends, and their friends. More content is coming soon. Thank you.

Checkout more:
After Effects ExtendScript Training: Ep. 3
Fast Marker Creator After Effects Script
After Effects ExtendScript Training: Ep. 17 Part 3
Free Function Friday Ep.30 – addCompMarker
Houdini Mardini Hidden