konstantin magnus Posted November 5, 2018 Share Posted November 5, 2018 Is there a way to automatically create and unlock all nodes from a specific section of the node menu? Quote Link to comment Share on other sites More sharing options...
Drughi Posted November 5, 2018 Share Posted November 5, 2018 Maybe use the OnCreated script to do so. There is the python command toolMenuLocations() to check the the Menu Folder. If the node is in the Folder you can use allowEditingOfContens(). Quote Link to comment Share on other sites More sharing options...
Drughi Posted November 5, 2018 Share Posted November 5, 2018 (edited) Maybe I got you wrong. To create all of them just do it once by hand and then make a shelf out of it. (Select all Nodes and drag them to the shelf) Edited November 5, 2018 by Drughi Quote Link to comment Share on other sites More sharing options...
konstantin magnus Posted November 5, 2018 Author Share Posted November 5, 2018 The question was rather how to create all nodes from a specific folder like "terrain" or "test geometry" via script. Quote Link to comment Share on other sites More sharing options...
vtrvtr Posted November 5, 2018 Share Posted November 5, 2018 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 4 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.