Another bit, recursive search through all connected nodes. Later I will layout these connected “trees” nicely. Cameras, Lights, ROPs into specific locations.
Inside SOP Geo nodes, I also like to have multiple separate trees (multiple OUT… / Object Merge… / OUT… / Object Merge / OUT…) so I will layout those trees automatically in logical order of dependencies, left to right.
def getConnectedNodes(node,got): iteration =  inout =  inout += node.inputs() inout += node.outputs() for n in inout: if n not in got: got.append(n) iteration.append(n) iteration += getConnectedNodes(n,got) return iteration selection = hou.selectedNodes() allConnected =  allConnected = getConnectedNodes(selection,allConnected)
This is just the beginning of the journey! I like the new “Layout All” system in H16, hotkey L or Shift-L for selected nodes. It behaves quite logically, 99% times I can rely on automatic layout. The remaining 1% I will solve by python script.
This small part takes all the Chopnets and positions them beside their appropriate Channel SOPs. Naming convention has to be maintained. To be continued.
# define offset offsetx = 3; offsety = 0; import hou import toolutils # container path active_pane = toolutils.activePane(kwargs) if active_pane is not None and active_pane.type() == hou.paneTabType.NetworkEditor: containerpath = active_pane.pwd().path() # find all chopnets chopnets = hou.node(containerpath).glob("chopnet_*") # for all for ch in chopnets: xxx,task = ch.name().split("_") # appropriate channel node path_channel = containerpath + "/channel_" + task path_chopnet = containerpath + "/chopnet_" + task node_channel = hou.node(path_channel) node_chopnet = hou.node(path_chopnet) # get posx = node_channel.position() + offsetx posy = node_channel.position() + offsety # set node_chopnet.setPosition( [posx,posy] )