I wanted the jpeg to be rendered as soon as the DPX was rendered. So
that rendering a 1000+ images in the UI, the rendering time of the jpg
would be nearly imperceptible unlike waiting at the end for several
seconds for 1000+ frames all at once. But looks like the afterRender
will be the next option.

But this drive me to one last question, how do you get the custom range
that was just rendered without doing a custom UI to render the write ?

On Wed, Aug 15, 2012, at 13:33, Nathan Rusch wrote:

Have you checked the terminal for errors being emitted from the spawned
threads?

I think what’s happening is that, since nuke.executeInMainThread
doesn’t wait for a result, and since the afterFrame/afterRender
callbacks are all run from inside a Nuke execution context, the calls
to nuke.execute don’t actually get run (I would expect RuntimeErrors to
be raised in the external threads with the “I’m already executing
something” error).

If you want to render a range, why not just do it all at once and spawn
the thread from afterRender?

-Nathan


From: [1]Hugo Léveillé
Sent: Wednesday, August 15, 2012 10:15 AM
To: [2]PYTHON (nuke) discussion
Subject: Re: [Nuke-python] afterFrameRender freezing....

Not working. Looks like nuke is not even rendering at all until it
reach the last frame.

Looks like a bug?

On Wed, Aug 15, 2012, at 12:56, John RA Benson wrote:

if that's the case, try this:
    nuke.tprint('Rendering: path.%04d.jpg' % f)
    w['file'].setValue("path.%04d.jpg" % f)
in other words, force the write node to render the frame you are
getting.
jrab
On 08/15/2012 06:16 PM, Hugo Léveillé wrote:

if I add a print statement like : print nuke.frame() in the def, it
prints the frame just rendered and not the same frame over and over
again.

On Wed, Aug 15, 2012, at 11:30, Howard Jones wrote:

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

Howard
  __________________________________________________________________

From: Hugo Léveillé [3]mailto:[email protected]
To: Nuke Python discussion
[4]mailto:[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
> >  [5][email protected]
> >
> > _______________________________________________
> > Nuke-python mailing list
> > [6][email protected],
[7]http://forums.thefoundry.co.uk/
> >
[8]http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
> >
> > _______________________________________________
> > Nuke-python mailing list
> > [9][email protected],
[10]http://forums.thefoundry.co.uk/
> >
[11]http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-pytho
n
>
>
> --
>  Hugo Léveillé
>  TD Compositing, Vision Globale
>  [12][email protected]
>
> _______________________________________________
> Nuke-python mailing list
> [13][email protected],
[14]http://forums.thefoundry.co.uk/
>
[15]http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-pytho
n
>
> _______________________________________________
> Nuke-python mailing list
> [16][email protected],
[17]http://forums.thefoundry.co.uk/
>
[18]http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-pytho
n
--
  Hugo Léveillé
  TD Compositing, Vision Globale
  [19][email protected]
_______________________________________________
Nuke-python mailing list
[20][email protected],
[21]http://forums.thefoundry.co.uk/
[22]http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-pytho
n

_______________________________________________

Nuke-python mailing list

[23][email protected],
[24]http://forums.thefoundry.co.uk/

[25]http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-pytho
n


--

Hugo Léveillé

TD Compositing, Vision Globale

[26][email protected]



_______________________________________________
Nuke-python mailing list
[27][email protected], [28]http://forums.thefoundry.co.uk/
[29]http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python




--
Hugo Léveillé
TD Compositing, Vision Globale
[30][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
[31][email protected],
[32]http://forums.thefoundry.co.uk/
[33]http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-pytho
n

References

1. mailto:[email protected]
2. mailto:[email protected]
3. mailto:[email protected]
4. mailto:[email protected]
5. mailto:[email protected]
6. mailto:[email protected]
7. http://forums.thefoundry.co.uk/
8. http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
9. mailto:[email protected]
  10. http://forums.thefoundry.co.uk/
  11. http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
  12. mailto:[email protected]
  13. mailto:[email protected]
  14. http://forums.thefoundry.co.uk/
  15. http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
  16. mailto:[email protected]
  17. http://forums.thefoundry.co.uk/
  18. http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
  19. mailto:[email protected]
  20. mailto:[email protected]
  21. http://forums.thefoundry.co.uk/
  22. http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
  23. mailto:[email protected]
  24. http://forums.thefoundry.co.uk/
  25. http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
  26. mailto:[email protected]
  27. mailto:[email protected]
  28. http://forums.thefoundry.co.uk/
  29. http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
  30. mailto:[email protected]
  31. mailto:[email protected]
  32. http://forums.thefoundry.co.uk/
  33. 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

Reply via email to