If you need that much control, it sounds like you would be better off rolling 
your own render front-end. For specific cases like you are describing, the 
easiest path would be creating a JPG write node before executing the render, 
then cleaning it up afterward. This way, the DPX and JPG outputs will share the 
same render buffers in Nuke, all but eliminating any extra overhead.

-Nathan



From: Hugo Léveillé 
Sent: Wednesday, August 15, 2012 10:52 AM
To: Nuke Python discussion 
Subject: Re: [Nuke-python] afterFrameRender freezing....

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: Hugo Léveillé
  Sent: Wednesday, August 15, 2012 10:15 AM
  To: 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é mailto:[email protected]
          To: Nuke Python discussion 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
          > >  [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

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



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