Jump to content

Create HDA using python


Korhon

Recommended Posts

This is the way I have done it in the past when creating a digital asset from a shelf tool:

# Create new digital using OBJ subnet as a base
temp_node = hou.node("/obj").createNode("subnet")

# Create new digital asset from temp node
hda_node = temp_node.createDigitalAsset(
  name = hda_name,
  hda_file_name = hdalib_directory + hda_name,
  description = "DESCRIPTION",
  min_num_inputs = 0,
  max_num_inputs = 0,
)

hda_node.setName("NAME")

# Get HDA definition
hda_def = hda_node.type().definition()

# --------------------------------------------
# Do whatever you need to do with the HDA here
# i.e. Creation, copying and organisation of children:

hou.moveNodesTo(tuple(other_premade_node), hda_node)
hda_node.layoutChildren()
# -------------------------------------------

# Update and save new HDA
hda_options = hda_def.options()
hda_options.setSaveInitialParmsAndContents(True)
hda_def.setOptions(hda_options)
hda_def.save(hda_def.libraryFilePath(), hda_node, hda_options)

 

  • Like 3
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.

Guest
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...