Houdini 20.0 Reference Windows

Viewer Handle Code Generator window

Utility to generate Viewer Handle code.


The Viewer Handle Code Generator dialog lets you create a new Python viewer handle script. The code generator provides pre-defined samples, ranging from basic to more complete viewer handle implementations. Each sample provides a class implementation and the mandatory createViewerHandleTemplate callback function.

In addition to samples, the code generator lets you choose from several options to generate the skeleton code of specific event handlers.


The code generator dialog is a tool for generating code, it’s not a tool to assist you in editing your python handle code. Once you enter and accept the dialog options, the code is generated and copied into the python editor. You cannot go back to the code generator, change options and expect your code to update accordingly.

To...Do this

Enter basic information

  1. Enter the viewer handle name in the Name field. This field is mandatory, if omitted an error message will popup.

  2. Optionally, enter a Label, Description and Icon for the new viewer handle. If omitted, the label and description will be inferred from the viewer handle name field. If the icon is omitted is used.

Select a Sample

  • Blank: Generates an empty class implementation. This is the default sample.

  • Complete: Generates an empty class implementation with all available event handlers.

  • Gadget: Generate the code to demonstrate gadgets for python handles.

  • Rotate: Generate a simple rotate handle for changing the Y rotate parm of a geometry.

  • Translate: Generate a translate handle class with a pivot gadget for moving a geometry in world space.

  • Scaling: Generate a scale handle class for scaling a geometry along the X, Y or Z axes.

Select Event Handlers

  • Select one of the Event Handler options if you wish to customize the selected sample code.

Select Debug Context Menu

Generate the new python viewer handle code

  • Click the Accept button to generate and copy the new code over to the python editor.

  • If the python viewer handle file already exists on disk, Houdini will popup a dialog asking if you want to overwrite it or cancel the new viewer handle.

  • The new python handle will be loaded and listed in the Viewer Handle Browser tree.

Cancel the current code generation

  • Click the Cancel button to cancel the code generation task.

Reset the input

  • Click the Clear button to reset the dialog input including the python handle name, sample, event handlers, etc…