connectMultipleMask

connectMultipleMask.py

Nuke having its won short key for connecting selected multiple nodes input into one target node. It is underedit menu. Goto edit --> node --> splay first will do the job. There are three more combination of shot keys with 'U'. Check with each one and enjoy. Thanks to Frank Rueter to give the information.

Even-though nuke don't have short-cut key for connect multiple selected nodes 'Mask' input to target node.

Tried with 'splayLast to A' 'splayFirst to A', But it connect single input nodes mask input to target node and fails with 2 or more inputs node.

check ref image:


Because splay short-cuts are working based on input order. Its not considering optional inputs. If input 0 is none it will connect 0 to target and so one so forth with other inputs :). Hmmmmm  good ya..

Yup then how to connect all selected nodes 'mask' input to target node with single click ?

Here is the script for connect multiple nodes mask input to target node. This script will connect selected nodes mask input to target node. It will do nothing if no mask input nodes.

check ref image:


connect multiple nodes masks input to target node. Make sure your selecting the target node at last. Select the nodes need to connect and then shit+select the target node. If select with mouse drag function make sure to select the target node at last. Then hit the short-cut key. Bang!!!!  all your nodes mask input connected with target node.

Hope this will help you friends.,

Download:

connectMultipleMask.py


Raw Code:


'''
@author: satheesh-R
for bugs and reports,,  mail - satheesrev@gmail.com
'''

### connect multiple nodes masks input to target node. Make sure your selecting the target node at last.
### Select the nodes need to connect and then shit+select the target node. If select with mouse drag function make sure to select the target node at last.
### Then hit the short-cut key. Bang!!!!  all your nodes mask input connected with target node.

import nuke

def connectMultipleMask():
    try:
        selNode = nuke.selectedNode()
    except ValueError: # no node selected
        pass
    selCheck = selNode.optionalInput()
    if selCheck > 0:
        for node in nuke.selectedNodes():
            min_inputs = node.minInputs()
            if min_inputs > 2:
                node.setInput(2, selNode)
            if min_inputs == 2:
                node.setInput(1, selNode)
            if min_inputs == 1:
                pass
    if selCheck == 0:
        for node in nuke.selectedNodes():
            min_inputs = node.minInputs()
            if min_inputs > 2:
                node.setInput(2, selNode)
            if min_inputs == 2:
                node.setInput(1, selNode)
            if min_inputs == 1:
                pass







Comments

Popular posts from this blog

Export Nuke's retime information

Lock and unLock node settings in nuke

Working with UV pass inside NUKE