auto set node names

   1442   2   0
User Avatar
Member
155 posts
Joined: 11月 2015
Offline
Hello!

I want to build a setup where I only have to name the base geo node and everything gets set up via that string.

It already works on parameters with `opname(“..”)` but I couldn't find a way to do this with the name of a node.

Found this:
https://www.sidefx.com/docs/houdini/hom/hou/Node.html#setName [www.sidefx.com]
But I am not sure how I can implement it.

Any help would be great! Thanks!
User Avatar
Member
52 posts
Joined: 6月 2016
Offline
create a new tool in a shelf and type this code

# Get selected Node
selection = hou.selectedNodes()

# Loop for each selected node
for node in selection:
    nodeName = node.name() # Get the selected node name
    allChildren = node.allSubChildren() # List all children inside the node
    count = len(allChildren) # Counting the number of node inside
    
    # Loop for each node inside the selected node
    for i in range(0, count):
        childName = allChildren[i].name() # Get the name of the child Node
        newName = nodeName + '_' + childName # Create new name
        allChildren[i].setName(newName) # apply new name
        #print newName
User Avatar
Member
155 posts
Joined: 11月 2015
Offline
thanks! this helped a ton!
  • Quick Links