Hey,

First, you have to remember the selection, deselect all, toggle what nodes
are selected and move nuke.createNode() inside the loop and conditional. Oh,
you were setting the Remove node's knobs a bit wrong... were you trying to
remove the 'rgb' layer?

-Ean

sn = nuke.selectedNodes('Read')
for n in nuke.selectedNodes():
    n.setSelected(False)
for a in sn:
    if 'exr' in a['file'].value():
        a.setSelected(True)
        r = nuke.createNode('Remove')
        r['operation'].setValue('remove')
        r['channels'].setValue('rgb')
        for n in nuke.selectedNodes():
                n.setSelected(False)


On Wed, Oct 5, 2011 at 11:47 AM, kernowkid <
[email protected]> wrote:

> **
> Hi,
> I'm trying to add Remove node to each selected node. This is what I have so
> far but cant get it to work.
>
> *Code:*  n = nuke.createNode('Remove')
> for a in nuke.selectedNodes('Read'):
>         if 'exr' in a['file'].value():
>                 n['operation'].setValue(1)
>                 n['channels'].setValue(3)
>
> Any help appreciated.
>
> Thanks
>
> K
>
> _______________________________________________
> 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

Reply via email to