Adding Parameters to The Interface via Python

Posting this one for future reference. It’s been documented in plenty of places I’m sure but the more the merrier. You wouldn’t complain if there was extra beer in the refrigerator right? Thanks again to the super smart folks over at the ODForce Forums with this one.

Secret Sauce

I’ve been exploring some more Python in Houdini and got to a point where I needed to add some parameters to the interface programmatically. I figured it would be a piece of strawberry cake. Well, it wasn’t immediately obvious to me (story of my life) but here you go.

node = hou.node(“/obj”).createNode(“geo”)
parm_group = node.parmTemplateGroup()
parm_folder = hou.FolderParmTemplate(“folder”, “Extras”)
parm_folder.addParmTemplate(hou.FloatParmTemplate(“noise”, “Noise”, 1))
parm_folder.addParmTemplate(hou.FloatParmTemplate(“amp”, “Amp”, 2))
parm_folder.addParmTemplate(hou.FloatParmTemplate(“cat_treats”, “Cat Treats”, 3))





The hou.FloatParmTemplate() method constructs the parameter. As you can see, I pass in the name, label and dimension or number of components. There are many other arguments you can pass in. Check the docs for the whole deal. The init method is the following:

__init__(name, label, num_components, default_value=(), min=0.0, max=10.0, min_is_strict=False, max_is_strict=False, look=hou.parmLook.Regular, naming_scheme=hou.parmNamingScheme.XYZW, disable_when=None, is_hidden=False, is_label_hidden=False, join_with_next=False, help=None, script_callback=None, script_callback_language=hou.scriptLanguage.Hscript, tags={}, default_expression=(), default_expression_language=())

If you’re creating or manipulating assets, this is a good one to have in your small jeans pocket.



I am a motion designer & developer based out of South Florida. When not designing or animating pixels, I wrangle some code. If all else fails, I watch Twilight Zone, I Love Lucy, or Three's Company reruns.