Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
49 lines (48 sloc) 8.1 KB
Group {
name quickEdit
help http://richardfrazer.com/tools-tutorials/
knobChanged "if nuke.thisKnob().name() == 'inputChange': updateInputs( )"
selected true
xpos -100
ypos 343
addUserKnob {20 User}
addUserKnob {26 instructions l " " T "Click \"Update\" to activate node before use..."}
addUserKnob {26 ""}
addUserKnob {3 startatframe l "Start frame"}
startatframe 1001
addUserKnob {6 startat l "Start at specific frame" -STARTLINE}
startat true
addUserKnob {26 ""}
addUserKnob {3 handles l Handles}
handles 8
addUserKnob {6 use_handles l "Use handles" -STARTLINE}
use_handles true
addUserKnob {26 ""}
addUserKnob {3 inout l Keyframe}
inout {{curve}}
addUserKnob {6 keyin l in -STARTLINE}
keyin true
addUserKnob {6 keyout l out -STARTLINE}
addUserKnob {26 ""}
addUserKnob {4 reformattype l Reformat M {none width height fit fill distort "" ""}}
reformattype width
addUserKnob {26 ""}
addUserKnob {22 update l Update T "def frames_to_timecode(frames):\n\tframerate = nuke.root().fps()\n\th = frames / (3600*framerate)\n\tm = frames / (60*framerate) % 60\n\ts = frames / framerate % 60\n\tf = frames % framerate\n\treturn ( \"%02d\" % (h,) + \":\" + \"%02d\" % (m,) + \":\" + \"%02d\" % (s,) + \":\" + \"%02d\" % (f,))\n\ndef updateInputs():\n\n\tt = nuke.thisNode()\n\n\ttname = t.name()\n\n\tnuke.thisNode().begin()\n\n\n\tusehandles = t\['use_handles'].value()\n\tt\['handles'].setEnabled(usehandles)\n\thandles = t\['handles'].value()\n\n\tstartat = t\['startat'].value()\n\tt\['startatframe'].setEnabled(startat)\n\tstartatframe = t\['startatframe'].value()\n\n\t#print \"usehandles \" + str(usehandles)\n\n\tkeyin = t\['keyin'].value()\n\tkeyout = t\['keyout'].value()\n\n\tio = t\['inout']\n\tio.setAnimated(1)\n\tfor curve in io.animations():\n\t curve.clear()\n\n\tmaxinputs = 0 \n\n\tinputlist = \[]\n\n\tearliestframe = 9999999999999999999 \n\n\txend = 0\n\n\n\tfor x in range(0, t.maximumInputs()):\n\t if t.input(x) is not None:\n\t\t#print \"Input \" + str(x) + \" is \" + t.input(x).name()\n\t\tinputlist.insert( maxinputs, x)\n\t\tff = t.input(x).firstFrame()\n\t\tif (ff < earliestframe):\n\t\t earliestframe = ff\n\t\txend = x\n\t\tmaxinputs = maxinputs + 1\n#\t else:\n#\t\tprint \"Input \" + str(x) + \" is None\"\n\n\txend = xend + 1\n\n\t#print \"Inputs \" + str(maxinputs)\n\t#print \"InputList \" + str(inputlist)\n\t#print \"earliestframe \" + str(earliestframe)\n\t#print \"xend \" + str(xend)\n\n\tfor d in nuke.allNodes():\n\t nuke.delete(d) \n\n\tfj = 0\n\n\tp = -1000\n\n\n\tedl01 = \"\"\n\tedl02 = \"\"\n\tedl03 = \"\"\n\tedl04 = \"\"\n\n\tif (len(inputlist)):\n\n\t\tif (startat):\n\t\t firstframe = startatframe\n\t\telse:\n\t\t firstframe = earliestframe\n\n\t\tlastout = firstframe \n\n\t\ttotalframes = 0\n\n\t\tfor j in range(0, xend):\n\n\n\t\t iname = 'Input' +str(j)\n\t\t #print \"creating input \" + iname + \" \" + str(j)\n\n\t\t newInput = nuke.createNode('Input')\n\t\t newInput\['name'].setValue( iname )\n\t\t newInput.setXYpos( p, 450 ) \n\t\t newInput\['label'].setValue( \"\[value number]\" )\n\t\t newInput\['number'].setValue( j )\n\n\t\t #print \"checking for \" + str(j) + \" in \" + str(inputlist)\n\n\t\t if j in inputlist:\n\t\t\t#print \"found \" + str(j)\n\t\t\ti = t.input(j)\n\t\t\t#tf = i.upstreamFrameRange(j)\n\t\t\t#print tf\n\t\t\ttff = i.firstFrame()\n\t\t\ttfl = i.lastFrame()\n\t\t\tif(usehandles):\n\t\t\t tff = tff + handles\n\t\t\t tfl = tfl - handles\n\t\t\tf = (tfl - tff)+1\n\t\t\tjname = i.name()\n\t\t\t#print f\n\t\t\tif(f < 1):\n\t\t\t\t#print \"Input \"+str(j)+\" is too short (\" + str(f) +\" frames)\"\n\t\t\t\t#print \"Disconnecting input \" + str(j)\n\t\t\t\tnuke.message (\"Input '\" + jname + \"' is too short (\" + str(f) +\" frames)\")\n\t\t\t\tt.setInput(j, None)\n\t\t\telse:\n\n\t\t\t\trname = 'Reformat' +str(j)\n\t\t\t\tnewReformat = nuke.createNode('Reformat')\n\t\t\t\tnewReformat\['name'].setValue( rname )\n\t\t\t\tnewReformat.setXYpos( p, 550 ) \n\t\t\t\tnewReformat.setInput(0, nuke.toNode( iname ))\n\t\t\t\tnewReformat\['resize'].setValue( t\['reformattype'].value() )\n\t\t\t\t#print \"Reformat type: \" + str(t\['reformattype'].value())\n\n\t\t\t\tkname = 'Retime' +str(j)\n\t\t\t\t#print kname\n\t\t\t\tk = nuke.createNode( 'Retime' ) \n\t\t\t\tk\['name'].setValue( kname )\n\t\t\t\tk\['input.first_lock'].setValue('true')\n\t\t\t\tk\['input.last_lock'].setValue('true') \n\t\t\t\tk\['input.first'].setValue( tff )\n\t\t\t\tk\['input.last'].setValue( tfl ) \n\t\t\t\tk\['before'].setValue('black') \n\t\t\t\tk\['after'].setValue('black') \n\t\t\t\tk.setXYpos( p, 600 )\n\t\t\t\t#ki = 'Input' +str(j)\n\t\t\t\tk.setInput(0, nuke.toNode( rname ))\n\n\t\t\t\toname = 'TimeOffset' +str(j)\n\t\t\t\t#print oname\n\t\t\t\to = nuke.createNode( 'TimeOffset' ) \n\t\t\t\to\['name'].setValue( oname )\n\t\t\t\tooffset = lastout - tff\n\t\t\t\to\['time_offset'].setValue( ooffset )\n\t\t\t\to.setXYpos( p, 650 )\n\t\t\t\to.setInput(0, nuke.toNode( kname ))\n\n\t\t\t\tfin = int(lastout)\n\t\t\t\tfout = int(lastout+(f-1))\n\n\t\t\t\tif (keyin):\n\t\t\t\t io.animation(0).setKey(fin,0)\n\t\t\t\tif (keyout):\n\t\t\t\t io.animation(0).setKey(fout,0)\n\n\t\t\t\tedl01 = edl01 + str(j) + \") \" + i.name() + \"\\n\"\n\t\t\t\tedl02 = edl02 + \" \[\" + str(fin) + \"-\" + str(fout) + \"]\\n\"\n\t\t\t\tedl03 = edl03 + \" (\" + str(int(f)) + \" frames)\\n\"\n\t\t\t\tedl04 = edl04 + \" \" + frames_to_timecode(int(f)) + \"\\n\"\n\n\t\t\t\ttotalframes = totalframes + f\n\n\t\t\t\tlastout = lastout + f\n\n\t\t p = p + 100\n\t\n\t\tedl01 = edl01 + \"\\nTotal\"\n\t\tedl02 = edl02 + \"\\n \[\" + str(int(firstframe)) + \"-\" + str(fout) + \"]\"\n\t\tedl03 = edl03 + \"\\n (\" + str(int(totalframes)) + \" frames)\"\n\t\tedl04 = edl04 + \"\\n \" + frames_to_timecode(int(totalframes)) + \"\"\n\n\t\tfj=j+1\n\n\t\tnewMerge = nuke.createNode('Merge2')\n\t\tnewMerge\['name'].setValue( 'MergeFrames' )\n\t\tnewMerge.setXYpos( -900, 700 ) \n\n\t\tmi = 0\n\n\t\tfor j in range(0, xend):\n\t\t if j in inputlist:\n\t\t\t#print \"found \" + str(j)\n\t\t\tx = j\n\t\t\trname = 'TimeOffset' +str(x)\n\t\t\tif(mi==2):\n\t\t\t mi=mi+1\n\t\t\t#print(\"connecting input \" + str(mi) + \" to node \" + rname)\n\t\t\tnewMerge.setInput(mi, nuke.toNode( rname ))\n\t\t\tmi=mi+1\n\n\n\t\tfinalRetime = nuke.createNode( 'Retime' ) \n\t\tfinalRetime\['name'].setValue( 'FinalRetime' )\n\t\tfinalRetime\['input.first_lock'].setValue('true')\n\t\tfinalRetime\['input.last_lock'].setValue('true') \n\t\tfinalRetime\['input.first'].setValue( firstframe )\n\t\tfinalRetime\['input.last'].setValue( firstframe + (totalframes -1 ) ) \n\t\tfinalRetime\['before'].setValue('black') \n\t\tfinalRetime\['after'].setValue('black') \n\t\tfinalRetime.setXYpos( -900, 750 )\n\t\tfinalRetime.setInput(0, nuke.toNode( 'MergeFrames' ))\n\n\n\t\tnewOutput = nuke.createNode('Output')\n\t\tnewOutput\['name'].setValue( 'Output' )\n\t\tnewOutput.setXYpos( -900, 800 ) \n\t\tnewOutput.setInput(0, nuke.toNode( 'FinalRetime' ))\n\n\t\tnewOutput.hideControlPanel()\n\n\tt\['edl01'].setValue(edl01)\n\tt\['edl02'].setValue(edl02)\n\tt\['edl03'].setValue(edl03)\n\tt\['edl04'].setValue(edl04)\n\n\tiname = 'Input' +str(fj)\n\t#print \"creating final empty input \" + iname + \" \" + str(fj)\n\n\tnewInput = nuke.createNode('Input')\n\tnewInput\['name'].setValue( iname )\n\tnewInput.setXYpos( p, 450 ) \n\tnewInput\['label'].setValue( \"\[value number]\" )\n\tnewInput\['number'].setValue( fj )\n\n\tnuke.show(nuke.toNode(tname))\n\n\tnuke.toNode(tname).showControlPanel()\n\n\tt.end()\n\nupdateInputs()\n" +STARTLINE}
addUserKnob {52 func l INVISIBLE +INVISIBLE T "def updateInputs( ):\n if nuke.thisKnob().name() == 'inputChange': print 'beep! input has Changed'" +STARTLINE}
addUserKnob {26 ""}
addUserKnob {26 edl01 l " " T ""}
addUserKnob {26 edl02 l "" -STARTLINE T ""}
addUserKnob {26 edl03 l "" -STARTLINE T ""}
addUserKnob {26 edl04 l "" -STARTLINE T ""}
addUserKnob {26 ""}
addUserKnob {26 textabout l "" +STARTLINE T "QuickEdit v1.0 by Richard Frazer\nPlug in clips to quickly create a linear edit"}
}
Input {
inputs 0
name Input0
label "\[value number]"
selected true
xpos -1000
ypos 450
}
end_group