I'm assuming your script button is on the Gizmo itself. In that case, you just need to prompt for frames views (nuke.getFramesAndViews is an easy way if you're not interested in getting other parameters) and then call nuke.execute on your gizmo. You'll probably want to validate the input frames/views as well, which is easy enough to do using FrameRange/FrameRanges objects. One example:

import re

n = nuke.thisNode()
params = nuke.getFramesAndViews('Rendering node: %s' % n.fullName(), default=str(nuke.root().frameRange()))
if params is None:
   return
f, v = params
f = re.sub('\s+', '', f)
if not f:
   nuke.message('Enter some frames')
   return
try:
   nuke.execute(n, nuke.FrameRanges(f.split(',')), v)
except Exception:
nuke.message('A render error occurred. Please see the terminal for details.')
   raise


Hope this helps

-Nathan

-----Original Message----- From: [email protected]
Sent: Friday, April 13, 2012 11:19 AM
To: [email protected]
Subject: [Nuke-python] Write-node Gizmo/Python question

Hi,

I am no star in scripting, so this might be a simple question, but one I
can't solve even after searching the web for an answer.

I am making a Gizmo for our pipeline that manages our Nuke renders. Within
the Gizmo are 3 write nodes that I want to execute (if enabled in the
gizmo) when I hit the render button. But I don't know how to script
that... It is basically 'Render > Render All (F5)' or an if/else
statement. But it is beyond my knowledge at this point.

See attached image for further clarification.

Anyone who can help me with this? Thanks in advance!





_______________________________________________
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