Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A Python template for creating parameters in Houdini: https://gfxhacks.com/create-parameters-in-houdini-with-python
import hou
# get node (find the path in your node's info panel)
n = hou.node("/path/to/node")
# get existing list of parameters for the specified node
g = n.parmTemplateGroup()
# define folders and parameters
f = [
hou.FolderParmTemplate(
"folder1",
"Folder 1",
folder_type=hou.folderType.Simple,
parm_templates=[
hou.FloatParmTemplate("parm1", "Parameter 1", 1),
hou.FloatParmTemplate("parm2", "Parameter 2", 1)
]
),
hou.SeparatorParmTemplate("sep1"),
hou.ButtonParmTemplate(
"parm3",
"Parameter 3",
script_callback='print("Hello World!")',
script_callback_language=hou.scriptLanguage.Python
),
hou.FolderParmTemplate(
"folder2",
"Folder 2",
folder_type=hou.folderType.Simple,
parm_templates=[
hou.FloatParmTemplate("parm4", "Parameter 4", 1),
hou.FloatParmTemplate("parm5", "Parameter 5", 3)
]
),
hou.SeparatorParmTemplate("sep2"),
hou.ToggleParmTemplate("parm6", "Parameter 6", default_value=True)
]
# for each folder and parameter defined, add to the list
for i in f:
g.append(i)
# apply changes
n.setParmTemplateGroup(g)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment