Jump to content

Mass create nodes from tab menu


konstantin magnus

Recommended Posts

It's possible, but quite cumbersome because of how HDAs still use a xml to define these things. Also, it won't work with nodes that only have the category hardcoded (usually older nodes). It should work with the newer gamedev tools

 

import xml.etree.ElementTree as ET



def create_all_nodes_by_category(network, category):
    installed_hdas = hou.hda.loadedFiles()
    for hda in installed_hdas:
        definitions = hou.hda.definitionsInFile(hda)
        for definition in definitions:
            try:
                xml_content = definition.sections()["Tools.shelf"].contents()
                root = ET.fromstring(xml_content)
                tool = root.find("tool")
                submenu = tool.find("toolSubmenu").text
                if submenu == category:
                     network.createNode(definition.nodeTypeName())
            except:
                pass
                
create_all_nodes_by_category(hou.node("/obj/geo1"), "GameDev")

https://streamable.com/4yxqx

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