Hou DataBox: Simplifying Houdini UI Creation

 

In this article, I’ll share insights into the development of a personal Houdini package aimed at simplifying the creation of custom UIs on PDG nodes. This package enhances workflows by enabling rapid prototyping, efficient UI design, and seamless integration of external Python libraries within Houdini’s Procedural Dependency Graph (PDG). I’ll also demonstrate how this workflow provides a robust foundation for building more complex UIs that would have been impractical to achieve using the standard HDA workflow.

Motivations

Houdini’s PDG is ideal for automating and scaling complex workflows, excelling in tasks like simulations and data processing. It integrates seamlessly with external Python libraries, enhancing workflows. However, creating custom UIs in Houdini can be time-consuming and challenging for rapid prototyping. A more streamlined approach to UI development allows for quicker iterations, boosting productivity and creativity, especially for those like myself who focus on designing custom interfaces for professional and personal projects.

This drive for efficiency and innovation led to the creation of my Houdini package, “Hou Databox.” At its core, “Hou Databox” was designed to bridge the gap between external Python libraries and Houdini’s PDG, while also enabling the seamless transformation of Python snippets into TOP nodes. The package centers around the TOPs Python node as a fundamental component, addressing a key need: converting Python variables into PDG attributes. This capability ensures smooth data flow throughout the TOP graph, empowering users to efficiently reuse attributes in downstream nodes, further streamlining their workflows.

A final requirement was the ability to build child packages that could construct their UIs on top of the parent’s package base UI. This functionality would enable UI inheritance, eliminating the need to duplicate UI code across multiple packages using “Hou Databox.”

Implementation

Houdini offers utility files like 123.py and externaldragdrop.py to customize software behavior for specific events. Additionally, it uses PythonScripts.txt to manage Python node snippets. These files help centralize custom scripts for easy access, streamlining workflows. The Snippets button in the Houdini parameter editor (top-right corner) facilitates this process, and we use it to store the “Hou Databox” Python snippets, making them readily accessible for quicker iterations.

With custom code stored in our package, we can override how Houdini interprets specific “Hou Databox” snippets. When Houdini starts, it converts these snippets into Houdini tools, making them easily accessible from the TAB menu. At that point, creating a “Hou Databox” node triggers the associated tool and executes the previously described chain of operations behind the scenes.

When a custom node created with Hou Databox is selected from the TAB menu, the Houdini node’s tool (generating during Houdini start up) runs the following steps:

  • Create a TOP Python node.
  • Hou Databox overrides the TOP Python node UI, adding Python editors for UI and logic code, and populates these with the relevant snippets.
  • Parent package (if existing) overrides are applied, enabling UI/Behaviour inheritance (more on this in a later dedicated section).
  • Package-specific UI/Behaviour modifications are layered on top of the current node.
  • Finally, the current node’s UI code is executed and added over the node interface.

UI Creation

As shown below, in its simpler form, “Hou Databox” enables the creation of UI parameters using Houdini’s VEX syntax. The goal is to allow users already familiar with VEX to seamlessly build UIs within Python nodes as well.

pdg custom UIs


In addition to the basic UI parameters that can be created using the simpler VEX syntax, the “Hou Databox” package supports all existing Houdini parameters. It even includes an example node that demonstrates how to construct any of these parameters using a more advanced Python-based approach. Due to the large number of parameters, I’ve included a couple of screenshots to provide a clearer view, as it was not possible to capture all of them in a single image.

pdg custom UIs


pdg custom UIs


pdg custom UIs

Turning Snippets Into Nodes

“Hou Databox” accelerates prototyping by enabling quick iteration and the seamless transformation of Python snippets into functional nodes. Additionally, it allows the reverse operation once the user is satisfied with the custom node snippets they’ve created. At this point, the user can save the node’s state directly back into the PythonScripts.txt file of the designated package via the menu. This functionality ensures that the node can be easily recreated later, preserving custom scripts and allowing for a smooth, efficient workflow that supports future use and modifications.

pdg custom UIs

Simplifying Environment Setup

To facilitate quick prototyping, “Hou Databox” also includes the ability to populate a create environment node with the selected Houdini package’s requirements.txt file. This feature makes the necessary dependencies readily accessible from Houdini’s Python nodes, streamlining the integration of external libraries and enhancing the overall workflow.

pdg custom UIs

UI Inheritance

An important feature from Hou Databox is to allow child packages to construct their UIs on top of the parent’s base UI. This functionality enables UI inheritance, eliminating the need to duplicate UI code across multiple packages using “Hou Databox”.

To demonstrate the UI inheritance functionality behind “Hou Databox,” I created a child Houdini package called “Hou Pandas” to handle dataframes, a standard format for working with tabular data in Python. This package inherits all the functionality and default UIs provided by “Hou Databox.”

In addition, “Hou Pandas” introduces support for importing and remapping PDG attributes from upstream nodes, allowing them to be interacted with from the node’s logic editor. In its simplest form, a vanilla node looks like this:

pdg custom UIs

Notice the new “Package parms” folder in the top right UI, compared to the previous screenshot provided at the package level by the “Hou Pandas” package. This update allows me to specify if a node accepts dataframe inputs and which variable name should be assigned to them. Additionally, I can apply the same functionality at the export level to turn any variable containing a dataframe into a PDG attribute. For optimization purposes, this package also supports the functionality of loading or saving a dataframe from/to an Excel file.

pdg custom UIs


This package also enables the creation of custom nodes specialized in dataframe manipulation. This is extremely useful, as any child package from “Hou Pandas” can leverage these nodes to modify their dataframes, without the need to recreate similar nodes in each child packages.

pdg custom UIs


Showcasing the Power of Hou Databox

Using “Hou Pandas” as a foundation, I developed a child package called “Hou Fin,” which is specialized in financial analysis within PDG. All “Hou Fin” nodes inherit the default “Hou Pandas” UI, which includes functionality for importing and exporting dataframes, as mentioned previously. From there, the nodes build upon the UI with specific code tailored to their financial analysis features, enabling the rapid design of workflows that leverage external financial Python packages directly within Houdini.

To keep things concise, I won’t delve more than I did into Hou Fin in this article, as I’ve written another article showcasing its use cases in detail. You can read it here if this might be of interest for you.

to explore how Hou Fin works and the scenarios where it shines. This being said, by adopting the workflow provided by “Hou Databox,” I was able to significantly scale up my node’s UI capabilities, enabling the creation of nodes that would have otherwise been impractical within a reasonable timeframe.

An excellent example is a node I created to query data from the financial website finviz. To replicate the site’s filter interface, the UI had to support around 70 menus, each containing several dozen options. Below, you’ll find the original webpage showcasing the filter list, along with a video demonstrating how this UI was implemented within a Python TOP node using “Hou Databox” and “Hou Pandas”.

pdg custom UIs

Accomplishing this level of complexity manually with a standard HDA would have been incredibly time-consuming, to the point where it would no longer be practical. However, with “Hou Databox,” the streamlined process makes it possible to develop such intricate interfaces both efficiently and effectively.

Limitations

The first I’ll mention isn’t directly related to Hou Databox but is still something to have in mind when working with it. While integrating multithreaded Python packages, I encountered crashes during PDG work item processing. To address this, I executed the PDG graph from Houdini’s main thread, leading to sequential work item execution, which removed parallelization. Although this didn’t affect my use case, it could be an issue in other scenarios.

Additionally, since Hou Databox doesn’t currently convert UI parameters into JSON, it limits the ability to run out-of-process. However, this wasn’t problematic in my case, as I could still use Houdini headlessly via the command line.

Final Thoughts

In this article, I’ve shared how I leverage my “Hou Databox” package to efficiently design UI that facilitate external Python libraries integration within Houdini. I demonstrated how the package enables users to save nodes as Python snippets, which can later be recreated directly from the TAB menu, streamlining the workflow for both prototyping and reuse.

Additionally, I showcased how UI inheritance allows for the creation of topic-specific packages that benefit from the default UI and behavior of their parent packages without the need to have redundant code. This approach fosters consistency while reducing the effort required to build specialized tools. Finally, I highlighted how the package simplifies rapid iteration during UI design opening scaling up in complexity the UI when needed, “Hou Databox” significantly accelerates the process, making it a powerful tool for enhancing productivity and creativity.

If you’re interested in exploring what I’ve built on top of “Hou Databox” and “Hou Pandas”, feel free to read the dedicated article on Hou Fin here for more details.