Skip to content

Instantly share code, notes, and snippets.

@morphingdesign
Last active October 10, 2022 16:30
Show Gist options
  • Save morphingdesign/d5a6fe3a83913c0d0f6ff3560a1095dd to your computer and use it in GitHub Desktop.
Save morphingdesign/d5a6fe3a83913c0d0f6ff3560a1095dd to your computer and use it in GitHub Desktop.
Add custom parameters and folder to Houdini node
# Acquire node from network
node = hou.node('/obj/geo/node')
# Add folder used to collect all newly create parameters
folder = hou.FolderParmTemplate("folder", "Folder Name")
# Define folder type; default is Tabs. Set to Simple
folder.setFolderType(hou.folderType.Simple)
# Add parameter types, defined by parameter name, label, and number of components
# Add float parameter
folder.addParmTemplate(hou.FloatParmTemplate("parm1", "Parameter 1 Name", 1))
# Add vector2 parameter
folder.addParmTemplate(hou.FloatParmTemplate("parm2", "Parameter 2 Name", 2))
# Add vector3 parameter
folder.addParmTemplate(hou.FloatParmTemplate("parm3", "Parameter 3 Name", 3))
# Add integer parameter
folder.addParmTemplate(hou.IntParmTemplate("parm4", "Parameter 4 Name", 1))
# Add string/image file reference parameter
folder.addParmTemplate(hou.StringParmTemplate("image_file", "Texture File", 1, string_type=hou.stringParmType.FileReference, file_type=hou.fileType.Image))
# Other parameter types available:
# https://www.sidefx.com/docs/houdini/hom/hou/ParmTemplate.html
# Add parameters to node
# Define parameter group used to collect folder/s
group = node.parmTemplateGroup()
# Add folder to group and group to node
group.append(folder)
node.setParmTemplateGroup(group)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment