Add an HDA to houdini using Python

   2800   2   0
User Avatar
Member
12 posts
Joined: Feb. 2018
Offline
Hey there,

I have a python script creating a bunch of node for artists to use. My problem comes in when I want to add an hda in.

So code goes like this

# Initialize parent node variable.
if locals().get(“hou_parent”) is None:
hou_parent = hou.node(“/obj/geo1”)

# Code for /obj/geo1/sphere1
hou_node = hou_parent.createNode(“sphere”, “sphere1”, run_init_scripts=False, load_contents=True, exact_type_
name=True)
hou_node.move(hou.Vector2(-48.0151, 10.0539))

# Code for /obj/geo1/remesh1
hou_node = hou_parent.createNode(“remesh”, “remesh1”, run_init_scripts=False, load_contents=True, exact_type_
name=True)
hou_node.move(hou.Vector2(-48.0151, 9.05386))

# Then I would like to bring in my HDA here #
##### Code to import an HDA like you would other nodes


# Code for /obj/geo1/output0
hou_node = hou_parent.createNode(“output”, “output0”, run_init_scripts=False, load_contents=True, exact_type_
name=True)
hou_node.move(hou.Vector2(-48.0151, 6.52819))

#ext…


when they pressed the button it needs to end up looking like the image attached:


If tried looking into:

https://forums.odforce.net/topic/32386-create-hda-using-python/ [forums.odforce.net]
http://www.sidefx.com/docs/houdini/hom/hou/HDAOptions.html [www.sidefx.com]

But have had no luck.

Any help would be greatly appreciated.
Thanks

Attachments:
Capture.JPG (16.8 KB)

User Avatar
Member
106 posts
Joined: June 2011
Offline
Hi there

Is this what you're looking for ?

# This code is the equivalent of running Assets -> Install Asset Library
hou.hda.installFile('path_to_your_hda_file_on_disk')

# Then you could create the HDA as you would normally with any other node
hda_node = hou_parent.createNode("OperatorType”, “Name”) # Operator Type is your hda type

-J
User Avatar
Member
12 posts
Joined: Feb. 2018
Offline
Actually that did work thanks a lot
Edited by SuekieZA - Sept. 6, 2019 15:55:14
  • Quick Links