hexColour = int('%02x%02x%02x%02x' % (r*255,g*255,b*255,1),16)
c = nuke.toNode("YourNode")
text = nuke.Text_Knob(name,label,"text")
c.addKnob(knob)
nuke.execute(writeNode.name(), x, x, 5)
import time
myTask = nuke.ProgressTask("Progress")
for n in range (1,11):
time.sleep(0.1)
myTask.setProgress((n*100)/10)
print n
del myTask
Put all functions in one place in a gizmo and execute them separately
Thanks Wouter Gilsing
http://community.foundry.com/discuss/topic/127752
Example:
set cut_paste_input [stack 0]
version 9.0 v9
push $cut_paste_input
NoOp {
name NoOp1
selected true
xpos 144
ypos 168
addUserKnob {20 User}
addUserKnob {22 master l "master (hide this knob)" T "node = nuke.thisNode()\n\ndef function1():\n node.knob('label').setValue('Button 1 was clicked')\ndef function2():\n node.knob('label').setValue('Button 2 was clicked')\ndef function3():\n node.knob('label').setValue('Button 3 was clicked')\n\nfunctionPick = node.knob('functionPicker').value()\n\nif functionPick == '1':\n function1()\nelif functionPick == '2':\n function2()\nelse:\n function3()" +STARTLINE}
addUserKnob {4 functionPicker l "hide this pulldown" -STARTLINE M {1 2 3 "" "" ""}}
addUserKnob {26 ""}
addUserKnob {22 button1 T "node = nuke.thisNode()\n\nnode.knob('functionPicker').setValue('1')\nnode.knob('master').execute()" +STARTLINE}
addUserKnob {22 button2 -STARTLINE T "node = nuke.thisNode()\n\nnode.knob('functionPicker').setValue('2')\nnode.knob('master').execute()"}
addUserKnob {22 button3 -STARTLINE T "node = nuke.thisNode()\n\nnode.knob('functionPicker').setValue('3')\nnode.knob('master').execute()"}
}
For setting knob default and adding plugin path use init.py
For making UI stuffs like menus and adding hotkeys use menu.py
________________________________________________________________________________________________________________
knob.setSingleValue(False)
For Ex : nuke.toNode("Grade1")["white"].setSingleValue(False)
________________________________________________________________________________________________________________
first we need to switch the display of the knob from single to multichannel knob using
knob.setSingleValue(False)
then
knob.setExpression("expression as string",channel index)
For Ex : g["white"].setExpression("CurveTool2.intensitydata.r/CurveTool2.intensitydata.r(1)",0)
_______________________________________________________________________________________________________________
This is pretty easy
knob.setSingleValue(False)
knob.setValue([0,0,0,0])
for n in nuke.hotkeys().split('\n'):
print n
add this in init.py
def setCurrent():
nuke.thisNode()["first_frame"].setValue(nuke.frame())
nuke.addOnUserCreate (setCurrent, nodeClass="FrameHold")
seq Renamer WIP
import os
node = nuke.selectedNode()
dire = os.path.dirname(node["file"].getValue())
rawSource = os.path.basename(node["file"].getValue())
source = rawSource.split(".")[0]
ext = rawSource.split(".")[-1]
startframe = int(node["origfirst"].getValue())
p = nuke.Panel("Sequence Renamer")
p.addSingleLineInput("source",source)
p.addSingleLineInput("newName",source)
p.addSingleLineInput("startframe",startframe)
p.addSingleLineInput("inc",1)
p.show()
oldName = p.value("source")
newName = p.value("newName")
startframe = int(p.value("startframe"))
increment = int(p.value("inc"))
frameNum = startframe
files = os.listdir(dire)
for pic in files:
source = oldName+"."+str(frameNum)+"."+ext
print source
if pic == source:
old = dire+"/"+source
new = dire+"/"+newName+"."+str(frameNum)+"."+ext
print old
print new
os.rename(old,new)
frameNum += 1