can't check it in nuke right now, but on a first glimpse you're having some indentation problems... like you're mixing tabs and spaces and the if statement should be one level higher then the for loop.

also i think you should import nuke (or is that unnecessary?). something like this:


import nuke
def connectAOV():
    reads = nuke.selectedNodes("Read")
    noops = nuke.allNodes("NoOp")
    for r in reads:
            for n in noops:
                if r['label'].value() == n['name'].value():
                    #get NoOp position
                    x = n['xpos'].value()
                    y = n['ypos'].value()
                    #set Read nodes postion
                    r.setXpos(x)
                    r.setYpos(y - 200)
                    n.setInput(0, r)


or here a pastebin in case formatting gets messed up:
http://pastebin.com/7kSpCv6q




On 8/17/12 at 10:44 AM, [email protected] (RP) wrote:

Hello all again,
So I have this problem, I have this little script which connects a bunch of CG passes to a bunch of Noops based on name matching, it works great in the script editor, but if I try to import it into menu.py i get the usual 'error interpreting this plugin'

What am I doing wrong?

RP

def connectAOV():

reads = nuke.selectedNodes("Read")
noops = nuke.allNodes("NoOp")

for r in reads:
for n in noops:
if r['label'].value() == n['name'].value():
#get NoOp position  x = n['xpos'].value()
y = n['ypos'].value()
#set Read nodes postion      r.setXpos( x )
r.setYpos( y -200 )
n.setInput(0,r)





-----
_______________________________________________
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