Jump to content

Programmatically generate HDA`s with python

Johannes Saam

Recommended Posts

Hey ,

I am trying to create an hda wih python. Lets say i want to generate an otl that contains a grid node and a parameter that creates its divisions. Clicking that together is easy. How do you aproach creating that in python only save the otl somewhere and install it in the current scene? I found hou.HDADefinition but can not get it to work. Does somebody want to share this?


Thanks Jo

Link to comment
Share on other sites

You'd need to do something like the following:

- Create a grid

- Collapse the grid into a subnet with hou.Node.collapseIntoSubnet()

- Convert the subnet to a digital asset using hou.Node.createDigitalAsset()

- Create a hou.IntParmTemplate to represent your divisions parameter and add it to the digital asset definition using hou.HDADefinition.addParmTuple()

- Link the parameters on the grid to the parameter you just added.

- Save the asset using hou.HDADefinition.updateFromNode()

- Lock the node using hou.Node.matchCurrentDefintion()

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...