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