Hmm, I see. Well, one other question, I guess, is if you’re getting CDLs, is there a reason you can’t use OCIOCDLTransform nodes to apply them? Or are you using LUTs to make the transforms available outside of Nuke as well?
I would try spawning your loop function on a separate thread, and maybe sticking in a short sleep between node connections for good measure. I haven’t tested this, but it should allow the main processing thread to be released to evaluate the nodes in question. Might look something like: import threading import time def writeIt(node): node.setSelected(True) nukescripts.connect_selected_to_viewer(0) node.setSelected(False) def setLutNodes(nodes): for n in nodes: # If it meets the criteria... nuke.executeInMainThread(writeIt, args=(n,)) time.sleep(1) # Main entry point (could be in a function...) threading.Thread(target=setLutNodes, args=(nuke.allNodes(),)).start() Hope this helps. -Nathan From: Dan Rosen Sent: Friday, November 02, 2012 11:40 AM To: Nuke Python discussion Subject: Re: [Nuke-python] control viewer Hi Nathan, Thanks for the reply. We unfortunately don't write the plugin in-house. We are moving away from using it by implementing OCIO, but it currently still provides us the ability to format different luts for other software packages. It's pretty rare, but only time that it comes up for us to process hundreds of luts (via this Nuke/py process) is when working on a show with CDLs per shot from the DP. We've been providing CDLs as 3DL lut files back to production, so it's handy to script the process to format and output/name them all this way. thx Dan On Thu, Nov 1, 2012 at 10:48 PM, Nathan Rusch <nathan_ru...@hotmail.com> wrote: GUI updates and redrawing cannot occur while a block of Python code is executing. I don’t know the details of Nuke’s core threading design, but it seems that things like nuke.message may cause the lock on the thread responsible for hashing, validation, etc. (which may be separate from the GUI thread) to be released temporarily, allowing the tree to be evaluated. A couple initial questions would be: 1) Where in the plugin code is the LUT written? (_validate, engine, etc.) 2) Is there a reason you can’t/don’t want to make it an executable op? -Nathan From: Dan Rosen Sent: Thursday, November 01, 2012 3:23 PM To: Foundry Subject: [Nuke-python] control viewer Hi, I have a plugin that writes luts, but only by viewing through the node itself. There is no execute button a la GenerateLUT or Write. I use python to troll my Nuke flow-graph when setting up multiple lut outputs. The problem is when I have many luts only the last one is writing out in a for loop. I know that each one should be working since I have a print statement to show that it should be. Also, if I throw up a nuke.message("writing lut") then it works and all the luts are written. I just don't want to have to hit the 'OK' button. That pause is allowing enough time to get the node to successfully write. Having said that a regular python pause or a Nuke python progress bar doesn't work in the same way. My question is if the nuke.message is actually allowing the viewer to update. Any suggestions of other ways to force viewer update or similar? I've tried having the viewer forward a frame and back, but that isn't doing the same thing as the nuke.message. Maybe there's a way to automatically close the nuke.message pop-up? Here's a snippet of the code: def writeIt(n): n.setSelected( True ) nukescripts.connect_selected_to_viewer(0) n.setSelected( False ) def setLutNodes(): for n in nuke.allNodes(): if n.name() == "SHOT_LUT_CDL_3DL": n['lookFile'].setValue(file_output_lut_cdl_3dl) print "writing " + file_output_lut_cdl_3dl writeIt(n) elif n.name() == "SHOT_LUT_3DL": n['lookFile'].setValue(file_output_lut_3dl) print "writing " + file_output_lut_3dl writeIt(n) elif n.name() == "SHOT_LUT_3DL_W_OFFSET": n['lookFile'].setValue(file_output_lut_3dl_w_offset) print "writing " + file_output_lut_3dl_w_offset writeIt(n) elif n.name() == "SHOT_LUT_CUBE": n['lookFile'].setValue(file_output_lut_cube) print "writing " + file_output_lut_cube writeIt(n) elif n.name() == "SHOT_LUT_TXT": n['lookFile'].setValue(file_output_lut_txt) print "writing " + file_output_lut_txt writeIt(n) elif n.name() == "SHOT_LUT_LUT": n['lookFile'].setValue(file_output_lut_lut) print "writing " + file_output_lut_lut writeIt(n) elif n.name() == "SHOT_LUT_ACV": n['lookFile'].setValue(file_output_lut_acv) print "writing " + file_output_lut_acv writeIt(n) elif n.name() == "SHOT_LUT_ICC": n['lookFile'].setValue(file_output_lut_icc) print "writing " + file_output_lut_icc writeIt(n) ------------------------------------------------------------------------------ _______________________________________________ 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 -------------------------------------------------------------------------------- _______________________________________________ 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