Brendan Dawes
The Art of Form and Code

Dynamically Populating Houdini Menus with Data to Use as an Interface Element

A quick screen cast to show how I go about creating interface elements in Houdini from data, which can be used to drive various elements of the visuals.

Below is the Python code used to populate the menu:

points = hou.node("./data").geometry().points()
list = [];
for point in points:
    list.append(point.attribValue("City"));
    list.append(point.attribValue("City"));

return list

And here is the code used to store the selected city data:

string selectedCity = chs("../city");
string cityToCheck = sprintf(s@City);
if (cityToCheck == selectedCity) {

    setdetailattrib(0, "city", @City, "set");
    setdetailattrib(0, "density", @Density, "set");

}