Custom Scripts V: Single Node Paste

With this script you can paste a single node to a selection of nodes just with one click.

It has some limitations, though. Only one node can be pasted and after pasted, if you want to keep the node graph tidy, you must select all the new pasted nodes and press L.

Here it is:

def superPasteSingle():

    nodeList = []
    for s in nuke.selectedNodes():
        n = s['name'].value()
        nodeList.append(n)
    maxItemNumber = len(nodeList)
    itemNumber = 0
    while (itemNumber < maxItemNumber):
        nuke.nodePaste('%clipboard%')
        new_node = nuke.selectedNode()
        new_node.setInput(0, None)
        connect_to = nuke.toNode(nodeList[itemNumber])
        new_node.connectInput(0, connect_to)
        itemNumber = itemNumber + 1

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.