You are getting an error because you are trying to set off the proxy render in the main thread while the main render is still running in it. So you need to launch the proxy render in a background thread BUT - WARNING!!!!" As the proxy render finishes it will again execute the afterFrame callback, toggling back to full res mode and rendering that again, and os forth. If you do this in a background thread every time you will spawn background nuke renders till the cows come home. So you need to make sure that when the callback is run and nuke is already in proxy mode, just return out of it to avoid an infinite render loop.

Since you need to run a background thread, you also need to make sure that your callback is picked up by the init.py so it's available for the command line render.
Here is an example - (not thoroughly tested!):
http://pastebin.com/nasGyEYz





On 1/25/13 5:34 PM, Jacob Harris wrote:
I'm trying to render both a full-res and a proxy-res file in one go by flipping from full res mode to proxy mode during a render. However, I'm having two problems: 1) it seems like Nuke doesn't want to stay in proxy mode if it's switched on while a render is taking place. And 2) I'm getting a RuntimeError when trying to execute the write node from the afterFrameRender callback.

It's this code:

    def toggleProxyAndRender(node):

        proxy = nuke.root().knob('proxy').value()
        print proxy

        nuke.root().knob('proxy').setValue(not proxy)

        proxy = nuke.root().knob('proxy').value()
        print proxy

        nuke.execute(node, 1, 1)


With this setup:

    set cut_paste_input [stack 0]
    version 7.0 v2
    CheckerBoard2 {
     inputs 0
     name CheckerBoard1
     selected true
     xpos -260
     ypos -249
    }
    Write {
     file /tmp/imageFull.jpg
     proxy /tmp/imageProxy.jpg
     file_type jpeg
     checkHashOnRead false
     version 30
     afterFrameRender toggleProxyAndRender(nuke.thisNode())
     name Write1
     selected true
     xpos -260
     ypos -136
    }


I get this behavior in 6.3v6 and 7.0v2.

Am I going about this the wrong way?


_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to