Jump to content

adding multiple nodes to selected


Supersaqib

Recommended Posts

Hi,

 

Is there a way to drop one type of node underneath selected nodes.

 

So if i have a bunch of object merges coming in and i want to add the name operator between the object merges and the next connected node, how could i do that. I assume through a script of some sort using hou.selectedNodes and hou.nodetype but i'm not able to put it all together. 

 

Help would be much appreciated.

 

Thanks

Link to comment
Share on other sites

it would be something like this

def insertNodeAfter(type = "null"):
    nodes = hou.selectedNodes()
    for node in nodes:
        connections = node.outputConnections()
        insertNode = node.createOutputNode(type)
        for connection in connections:
            outNode = connection.outputNode()
            outInput = connection.inputIndex()
            outNode.setInput(outInput, insertNode)

then you can call it on selected nodes and chose desired type of node being inserted

so for Name SOP it would be

insertNodeAfter("name")
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...