It looks like nukescripts.autocrop is already trying to operate on the current 
node selection, so you would need to loop through and set each node as the sole 
selection and then run it.

sel = nuke.selectedNodes()
[s.setSelected(False) for s in sel]
for s in sel:
    s.setSelected(True)
    nukescripts.autocrop(first=s['first'].value(), last=s['last'].value(), 
layer='a')

    s.setSelected(False)



Alternately, you could just manually create and execute your own CurveTool 
nodes.


-Nathan



From: Michael Garrett 
Sent: Friday, December 13, 2013 9:17 AM
To: Nuke Python discussion 
Subject: [Nuke-python] Run autocrop on multiple Reads?

Hi, 

I'm finding I can only run nukescripts.autocrop() on a single Read node. On 
multiple selected Read nodes, the frame range does not update. 

Here's what I have:

for s in nuke.selectedNodes(): 

  f=s['first'].value()

  l=s['last'].value()

  nukescripts.autocrop(first=f, last=l, layer='a')



If I print f,l at the end of that loop then the first and last frames for each 
Read node are correctly returned, but obviously there's something I'm doing 
here that's too simplistic. Any advice? Ultimately I want to just run this as a 
python script on the command line.



Thanks,

Michael



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