Issues exporting an HDA using python

   165   0   0
User Avatar
Member
1 posts
Joined: Aug. 2022
Offline
Hey guys
new to python in houdini and i have some issues.
ive made a simple cube, made a subnet with it, and added the scale parameter to the subnet's type properties.
My goal is to control the parameter using python. I found that i have to set the parameters before creating the HDA since the default values wont change. just the instance in the viewport.

when creating the hda though, the parameters are deleted. i did come across a thread solving the same issue, but i dont know how to combine the codes so that eventually ill have my new hda with the parameters.
That's my basic code:


cube = hou.node("/obj/box/subnet/")
scale = cube.parm("scale")
scale.set(4)
hda = cube.createDigitalAsset()


and that's the solution i found:


def promoteParams(node):
definition = node.type().definition()
params_group = node.parmTemplateGroup()
definition.setParmTemplateGroup(params_group)
definition.updateFromNode(node)


How do i combine those?
Thanks in advance!
  • Quick Links