It renders the frame you are on as you specified that in render_jpeg
'f=nuke.frame()'

 
Howard



>________________________________
> From: Hugo Léveillé <[email protected]>
>To: Nuke Python discussion <[email protected]> 
>Sent: Wednesday, 15 August 2012, 16:11
>Subject: Re: [Nuke-python] afterFrameRender freezing....
> 
>thanks
>
>Unfortunately, it's still not working as expected. Nuke is not hanging
>anymore, but it only rendering the last frame of the requested range. So
>I render 1-10 in the main write, I should be triggering 10 afterFrame
>callback, rendering the frame just rendered to jpeg. But it will only
>render frame 10. 
>
>Any clue why?? Here's my script now. The only difference from yours is
>that I create a temp rean so that the jpeg is rendered from the dpx and
>not the whole flow. 
>
>import threading
>
>def renderAWrite(node, start, end):
>
>    nuke.executeInMainThread(nuke.execute, args=(node, start, end),
>        kwargs={'continueOnError': True})
>
>def render_jpg():
>    f = nuke.frame()
>
>    read = nuke.createNode("Read",inpanel=False)
>    read['file'].setValue(nuke.thisNode()['file'].value())
>    read['first'].setValue(f)
>    read['last'].setValue(f)
>    w = nuke.createNode('Write', inpanel=False)
>    w['file'].setValue("path.%04d.jpg")
>    w.setInput(0, read)
>    t = threading.Thread(None, renderAWrite, args=(w, f, f))
>    t.start()
>
>
>
>  
>
>On Tue, Aug 14, 2012, at 15:20, Nathan Rusch wrote:
>> I think you may have the calling sequence and locations a little switched 
>> around... You only use nuke.executeInMainThread from within the code
>> that's 
>> running on the new thread.
>> 
>> 
>> import threading
>> 
>> def renderAWrite(node, start, end):
>>     nuke.executeInMainThread(nuke.execute, args=(node, start, end), 
>> kwargs={'continueOnError': True})
>> 
>> def afterRenderFunc():
>>     f = nuke.frame()
>>     w = nuke.createNode('Write', inpanel=False)
>>     w['file'].setValue('/path.%04d.jpg')
>>     w.setInput(0, nuke.thisNode().input(0))
>>     t = threading.Thread(None, renderAWrite, args=(w, f, f))
>>     t.start()
>> 
>> 
>> Hope this helps.
>> 
>> -Nathan
>> 
>> -----Original Message----- 
>> From: Hugo Léveillé
>> Sent: Tuesday, August 14, 2012 11:23 AM
>> To: Nuke Python discussion
>> Subject: Re: [Nuke-python] afterFrameRender freezing....
>> 
>> yeah but running nuke.execute ends in a "already executing something
>> else" ?
>> 
>> import threading
>> def renderMe(node,inP,outP):
>>     nuke.execute( node , inP , outP )
>> 
>> def render_jpg():
>>     frame = nuke.frame()
>>     w = nuke.createNode("Write")
>>     w['file'].setValue("/path.####.jpg")
>>     thread = threading.Thread( None , renderMe , args = ( w , frame ,
>>     frame )  )
>>     nuke.executeInMainThread( thread.start  )
>> 
>> 
>> 
>> 
>> 
>> 
>> On Tue, Aug 14, 2012, at 13:43, Nathan Rusch wrote:
>> > You can't call nuke.executeInMainThread from the main thread or Nuke will
>> > lock up.
>> >
>> > -Nathan
>> >
>> >
>> > -----Original Message----- 
>> > From: Hugo Léveillé
>> > Sent: Tuesday, August 14, 2012 10:39 AM
>> > To: PYTHON (nuke) discussion
>> > Subject: [Nuke-python] afterFrameRender freezing....
>> >
>> > I know there has been few discussions about this, but it's still failing
>> > on me. Basically I just want to render a simple jpg of the frame just
>> > rendered.
>> >
>> > the code:
>> > ----------------------------
>> >
>> > import threading
>> > def renderMe(node,inP,outP):
>> >     nuke.executeInMainThreadWithResult( nuke.execute , args = ( node ,
>> >     inP , outP ) , kwargs = { 'continueOnError' : True } )
>> >
>> > def render_jpg():
>> >     frame = nuke.frame()
>> >     w = nuke.createNode("Write")
>> >     w['file'].setValue("/path.####.jpg")
>> >     thread = threading.Thread( None , renderMe , args = ( w , frame ,
>> >     frame )  )
>> >     nuke.executeInMainThread( thread.start  )
>> >
>> >
>> > -------------------------------------
>> >
>> > I call render_jpg()
>> >
>> > Sometimes it works but more often than others the progress bar just
>> > freeze forever. Anyone knows what the problem might be ?
>> >
>> >
>> > -- 
>> >   Hugo Léveillé
>> >   TD Compositing, Vision Globale
>> >  [email protected]
>> >
>> > _______________________________________________
>> > 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
>> 
>> 
>> -- 
>>   Hugo Léveillé
>>   TD Compositing, Vision Globale
>>  [email protected]
>> 
>> _______________________________________________
>> 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
>
>
>-- 
>  Hugo Léveillé
>  TD Compositing, Vision Globale
>  [email protected]
>
>_______________________________________________
>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