Thanks Nathan,
I got it works already. Just changed the nuke.nodes to nuke.createNode
def AutoPremult():
s=nuke.selectedNode()
u=nuke.createNode("Unpremult")
u.setInput(0,s)
p=nuke.createNode("Premult")
p.setInput(0,u
On Thu, Sep 27, 2012 at 2:09 PM, Nathan Rusch <[email protected]>wrote:
> Sorry, slight typo in there. The append line in the nested loops should
> read:
>
> idxs.append(i)
>
> -Nathan
>
>
> *From:* Nathan Rusch <[email protected]>
> *Sent:* Thursday, September 27, 2012 2:01 PM
> *To:* Nuke Python discussion <[email protected]>
> *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 <[email protected]>
> *Sent:* Thursday, September 27, 2012 1:23 PM
> *To:* Nuke Python discussion <[email protected]>
> *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
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>
> ------------------------------
> _______________________________________________
> Nuke-python mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>
>
> _______________________________________________
> Nuke-python mailing list
> [email protected], http://forums.thefoundry.co.uk/
> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>
>
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python