Jump to content
Sign in to follow this  
Supersaqib

adding multiple nodes to selected

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

Share this post


Link to post
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")

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×