Let's try that again...

def groupKnobChanged():
    if nuke.thisKnob().name() == 'inputChange':
        n = nuke.thisNode()
        maxIndex = n.maximumInputs() - 1
        if n.input(maxIndex) is not None:
            # Last input is connected to something. Add a new one.
            with n:
                nuke.nodes.Input()
        else:
            # Find disconnected inputs at the end to remove
            lastIndex = n.inputs()
            if lastIndex < maxIndex:
                for inputNode in nuke.allNodes('Input', group=n):
                    if inputNode['number'].value() > lastIndex:
                        nuke.delete(inputNode)

_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to