Sorry, slight typo in there. The append line in the nested loops should read:
idxs.append(i) -Nathan From: Nathan Rusch Sent: Thursday, September 27, 2012 2:01 PM To: Nuke Python discussion Subject: Re: [Nuke-python] set node's output Guessing a little here, since I’m not entirely clear what you’re trying to do, but you probably want something like this: def autoPremult(): try: s = nuke.selectedNode() except ValueError: # No node selected return deps = s.dependent(nuke.INPUTS | nuke.HIDDEN_INPUTS) idxs = [] for d in deps: for i in range(d.inputs()): if d.input(i) is s: deps.append(i) break u = nuke.nodes.Unpremult() u.setInput(0, s) p = nuke.nodes.Premult() p.setInput(0, u) for d, i in zip(deps, idxs): d.setInput(i, p) -Nathan From: Jason P Nguyen Sent: Thursday, September 27, 2012 1:23 PM To: Nuke Python discussion Subject: [Nuke-python] set node's output How do you set the output to connect to the bottom of the tree? I have this but it kept branching out. ___________________ def AutoPremult(): s=nuke.selectedNode() u=nuke.nodes.Unpremult() u.setInput(0,s) p=nuke.nodes.Premult() p.setInput(0,u) ______________________ tried: p.setOutput(0) but still no luck. Thanks. J -------------------------------------------------------------------------------- _______________________________________________ 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 -------------------------------------------------------------------------------- _______________________________________________ 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
_______________________________________________ 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