Get the type name from the HDA definition

This commit is contained in:
MustafaJafar 2024-06-12 16:53:43 +03:00
parent 74d039feb9
commit 66994e81ca

View file

@ -28,14 +28,17 @@ class HdaLoader(plugin.HoudiniLoader):
# Get the root node
obj = hou.node("/obj")
# Create a unique name
counter = 1
namespace = namespace or context["folder"]["name"]
formatted = "{}_{}".format(namespace, name) if namespace else name
node_name = "{0}_{1:03d}".format(formatted, counter)
node_name = "{}_{}".format(namespace, name) if namespace else name
hou.hda.installFile(file_path)
hda_node = obj.createNode(name, node_name)
# Get the type name from the HDA definition.
hda_defs = hou.hda.definitionsInFile(file_path)
for hda_def in hda_defs:
type_name = hda_def.nodeTypeName()
hda_node = obj.createNode(type_name, node_name)
self[:] = [hda_node]