Jump to content

Editing Parameter Interface with Python

Recommended Posts

I'm writing a python script that populates geometry nodes and edits each node's parameter interface, and I've ran into a few problems. I'm new at python so forgive me. I have been able to create new folder tabs and populate them with float parameters fairly easily. This is what I used to create one of the float parameters......

partTemplate = hou.FloatParmTemplate("timeOffset", ("Time Offset"), 1, default_value=([0]), min=-10, max=10, min_is_strict=False, max_is_strict=False, look=hou.parmLook.Regular, naming_scheme=hou.parmNamingScheme.Base1, disable_when="", tags={})
hou.node('/obj/geometry1').addSpareParmTuple(partTemplate, in_folder=([character1]), create_missing_folders=True)

The problem is I also need file and integer parameters....... The commands I'm pretty sure I need are hou.FileReferenceParmTemplate() and hou.IntParmTemplate(). I can't get them to work and the help says they haven't been implemented yet!? Can anybody hook me up with a script example of how to successfully add these parameters or know of a work around? Thanks in advance for any help your able to give......

- Jake R

Share this post

Link to post
Share on other sites

ok..... just shortly after I posted this, I ran hou.asCode() on a node I manually built and figured out how to get file and int parameters to work. :) So I figured I'd share, incase anybody else has run into this problem....

curNode = hou.node('/obj').createNode('geo', 'character1')

timeTemplate = hou.IntParmTemplate( "timeOffset", "Time Offset", 1, default_value=([0]), min=-100, max=100, min_is_strict=False, max_is_strict=False, naming_scheme=hou.parmNamingScheme.Base1, disable_when="", tags={})
curNode.addSpareParmTuple( timeTemplate, in_folder=([spareFolder]), create_missing_folders=True)

fileTemplate = hou.StringParmTemplate( "fileIN", "File Input", 1, default_value=(["0"]), naming_scheme=hou.parmNamingScheme.Base1, string_type=hou.stringParmType.FileReference, disable_when="", tags={})
curNode.addSpareParmTuple( fileTemplate, in_folder=([spareFolder]), create_missing_folders=True)

Also, it's easy to create a new folder in the parm interface, but it puts it after the default tabs. Does anybody know how to move it from the last tab in the group to the first??? (ie. before the "Transform" tab...)


- Jake

  • Thanks 1

Share this post

Link to post
Share on other sites

I have a python code which have a loop to get alembic files path from a dictionary and now i want to add a new parameter for each alembic path in a specific node according to loop count using python. can anybody tell me how can i do that.

newbie to python and houdini



Share this post

Link to post
Share on other sites

Untested, off the top of my head:

node = hou.node('your_node')
ptg = node.parmTemplateGroup()
for i, file_path in enumerate(paths):
  pt = hou.StringParmTemplate('file%d' % i, 'File %d' %i, 1, file_path)


Or you could multi-parm block: hou.FolderParmTemplate( ... folder_type=MultiparmBlock)

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now