Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Group {
- name CornerPinOffset2
- tile_color 0xaa55ffff
- addUserKnob {20 PinControl}
- addUserKnob {26 CornerPinControls l "" +STARTLINE T "<font size=5><b>Corner Pin Data</b></font>"}
- addUserKnob {20 CornerPinData l "" +STARTLINE n 1}
- addUserKnob {41 to1 T cpMaster.to1}
- addUserKnob {41 enable1 -STARTLINE T cpMaster.enable1}
- addUserKnob {41 to2 T cpMaster.to2}
- addUserKnob {41 enable2 -STARTLINE T cpMaster.enable2}
- addUserKnob {41 to3 T cpMaster.to3}
- addUserKnob {41 enable3 -STARTLINE T cpMaster.enable3}
- addUserKnob {41 to4 T cpMaster.to4}
- addUserKnob {41 enable4 -STARTLINE T cpMaster.enable4}
- addUserKnob {20 endGroup_1 l endGroup n -1}
- addUserKnob {41 invert T cpOutput.invert}
- addUserKnob {41 filter T cpOutput.filter}
- addUserKnob {41 black_outside l "black outside" T cpOutput.black_outside}
- addUserKnob {41 motionblur T cpOutput.motionblur}
- addUserKnob {41 shutter T cpOutput.shutter}
- addUserKnob {41 shutteroffset l "shutter offset" T cpOutput.shutteroffset}
- addUserKnob {41 shuttercustomoffset l "" -STARTLINE T cpOutput.shuttercustomoffset}
- addUserKnob {26 ""}
- addUserKnob {26 OffsetControls l "" +STARTLINE T "<font size=5><b>Offset Controls</b></font>"}
- addUserKnob {41 offsetto1 l "offset to1" T offset1.translate}
- addUserKnob {22 control1 t "Show the transform jack by opening the control panel of the grouped transform node" -STARTLINE T "nuke.show(nuke.thisGroup().node('offset1'), True)"}
- addUserKnob {22 hide1 t "Closes the panel if you don't feel like doing it yourself" -STARTLINE T nuke.thisGroup().node('offset1').hideControlPanel()}
- addUserKnob {41 offsetto2 l "offset to2" T offset2.translate}
- addUserKnob {22 control2 t "Show the transform jack by opening the control panel of the grouped transform node" -STARTLINE T "nuke.show(nuke.thisGroup().node('offset2'), True)"}
- addUserKnob {22 hide2 t "Closes the panel if you don't feel like doing it yourself" -STARTLINE T nuke.thisGroup().node('offset2').hideControlPanel()}
- addUserKnob {41 offsetto3 l "offset to3" T offset3.translate}
- addUserKnob {22 control3 t "Show the transform jack by opening the control panel of the grouped transform node" -STARTLINE T "nuke.show(nuke.thisGroup().node('offset3'), True)"}
- addUserKnob {22 hide3 t "Closes the panel if you don't feel like doing it yourself" -STARTLINE T nuke.thisGroup().node('offset3').hideControlPanel()}
- addUserKnob {41 offsetto4 l "offset to4" T offset4.translate}
- addUserKnob {22 control4 t "Show the transform jack by opening the control panel of the grouped transform node" -STARTLINE T "nuke.show(nuke.thisGroup().node('offset4'), True)"}
- addUserKnob {22 hide4 t "Closes the panel if you don't feel like doing it yourself" -STARTLINE T nuke.thisGroup().node('offset4').hideControlPanel()}
- addUserKnob {22 showRefLines l "Show Ref Lines" t "Show Lines between pins, for lining up occluded corners." T "nuke.show(nuke.thisGroup().node('Roto1'), True)" +STARTLINE}
- addUserKnob {26 div l "" +STARTLINE}
- addUserKnob {22 LoadMochaAE l "Load Mocha AE Track" T "import nuke, re\n# is a comment about what following code does\n#??? is an informational side note\n#!!! is something that needs to be fixed or extended\n\n# Creates a Nuke Panel for the user to paste tracking data into.\np = nuke.Panel('Get MochaAE Track')\np.addMultilineTextInput('Track Data', '''Paste corner pin data from Mocha AE here. \\nMust be the type that supports RG Warp and mochaImport''')\np.addBooleanCheckBox('Motionblur On', True)\np.addSingleLineInput('Frame Offset', 'Frame Offset (Default: 0)')\n\nif not p.show():\n\traise\nmochatrack = p.value('''Track Data''')\ntext = mochatrack.splitlines(True)\ntry:\n\tif p.value('Frame Offset') == 'Frame Offset (Default: 0)':\n\t\tframe_offset = 0 + int(nuke.root().knob(\"first_frame\").value())\n\telse:\n\t\tframe_offset = int(p.value('Frame Offset')) + int(nuke.root().knob(\"first_frame\").value())\nexcept:\n\tnuke.message(\"Error! Start Frame must be an integer.\")\n\traise\nmotionblur_on = p.value('Motionblur On')\n# Get width and height from mocha tracking data\ncomp_width = int(re.search(r'Source Width\\t\\b\\d+\\b', mochatrack).group().split('\\t')\[1])\ncomp_height = int(re.search(r'Source Height\\t\\b\\d+\\b', mochatrack).group().split('\\t')\[1])\n\n\n# Iterates through every match for frame xpos ypos. The regex searches for <tab><int><tab><float/int><tab><float/int>\n# The search also matches 'Pin-####'. When a match for pin is found, it gets the corner number, and then skips getting frame and xpos/ypos\n# Data is added to a 4-dimensional list called track_data\n# The track_data list has 4 lists, one for each corner. Each of these lists has a list for each frame with frame,xpos,ypos data. \n# Therefore, track_data\[0] is the list of all frames for corner 1, track_data\[1] is corner 2, etc.\n# track_data\[0]\[23] would return \[frame,xpos,ypos] for frame 23 of corner 1\n\n# Initialize vars for loop\t\ntrack_data = \[\[],\[],\[],\[]]\nlast_frame = 0\nfor match in re.finditer(r'\\b\\d+\\b\\t\[-+]?\\b\[0-9]*\\.?\[0-9]+\\b\\t\[-+]?\\b\[0-9]*\\.?\[0-9]+\\b|Pin-\\d*', mochatrack):\n\tif re.match(r'Pin*', match.group()):\n\t\tcorner = int( match.group().split('-')\[1] )-1\n\t\tcontinue\n\tframe \t= int(match.group().split('\\t')\[0])\n\txpos\t= float(match.group().split('\\t')\[1])\n\typos\t= float(match.group().split('\\t')\[2])\n\ttrack_data\[corner].append(\[frame, xpos, ypos])\n\tlast_frame = frame\n\n# Converts the track_data corner order from AE to Nuke, since our data is stored in AE's corner format\n# Nuke is 1=LL, 2=LR, 3=UR, 4=UL. AE is LL=2, LR=3, UR=1, UL=0\ntrack_data\[0], track_data\[1], track_data\[2], track_data\[3] = track_data\[2], track_data\[3], track_data\[1], track_data\[0]\n\n\n##########################\n# Create CornerPin Node\n##########################\ncp = nuke.thisGroup().node('cpMaster')\n#cp = nuke.createNode('CornerPin2D')\nif motionblur_on == True:\n\tcp.knob('shutteroffset').setValue('centred')\n\tcp.knob('motionblur').setValue(20)\nto_knobs = \[ cp.knob('to1'), cp.knob('to2'), cp.knob('to3'), cp.knob('to4') ]\ncorner = 0\n# For each 'to' knob in the CornerPin node, set it to be animated, and for every frame in the track, set a key for xpos and ypos\n# frame\[0] is the frame number, frame\[1] is the xpos, frame\[2] is the ypos\n# ypos must be inverted (height - ypos), to be right in nuke\nfor knob in to_knobs:\n\tknob.setAnimated()\n\tfor frame in track_data\[corner]:\n\t\tknob.setValueAt( frame\[1], frame\[0]+frame_offset, 0 )\n\t\tknob.setValueAt( (comp_height - frame\[2]), frame\[0]+frame_offset, 1 )\n\tcorner += 1" +STARTLINE}
- addUserKnob {20 OffsetCornerPinData n 1}
- OffsetCornerPinData 0
- addUserKnob {41 to1_1 l to1 T cpOutput.to1}
- addUserKnob {41 to2_1 l to2 T cpOutput.to2}
- addUserKnob {41 to3_1 l to3 T cpOutput.to3}
- addUserKnob {41 to4_1 l to4 T cpOutput.to4}
- addUserKnob {20 endGroup n -1}
- }
- Input {
- inputs 0
- name Input1
- xpos 704
- ypos -263
- }
- CornerPin2D {
- to1 {{cpMaster.to1+offset1.translate} {cpMaster.to1+offset1.translate}}
- to2 {{cpMaster.to2+offset2.translate} {cpMaster.to2+offset2.translate}}
- to3 {{cpMaster.to3+offset3.translate x1 1794} {cpMaster.to3+offset3.translate x1 1014}}
- to4 {{cpMaster.to4+offset4.translate} {cpMaster.to4+offset4.translate}}
- invert false
- shutteroffset centred
- from1 {0 0}
- from2 {{input.width i} 0}
- from3 {{input.width i} {input.height i}}
- from4 {0 {input.height i}}
- name cpOutput
- xpos 704
- ypos -157
- }
- Output {
- name Output1
- xpos 704
- ypos -28
- }
- Transform {
- inputs 0
- center {{cpMaster.to4 i x1 0 x64 0 x172 0 x189 0 x1475 0} {cpMaster.to4 i x1 0 x64 0 x172 0 x189 0 x1475 0}}
- name offset4
- xpos 450
- ypos -210
- }
- Transform {
- inputs 0
- scale {1 0.74}
- center {{cpMaster.to1 i x1 0 x64 0 x172 0 x189 0 x1475 0} {cpMaster.to1 i x1 0 x64 0 x172 0 x189 0 x1475 0}}
- name offset1
- xpos 445
- ypos -106
- }
- CornerPin2D {
- inputs 0
- to1 {0 0}
- to2 {1920 0}
- to3 {1920 1080}
- to4 {0 1080}
- invert false
- motionblur 20
- shutteroffset centred
- from1 {0 0}
- from2 {1920 0}
- from3 {1920 1080}
- from4 {0 1080}
- name cpMaster
- xpos 509
- ypos -157
- }
- Transform {
- inputs 0
- center {{cpMaster.to3 x1 0 x4 0 0 x64 0 x172 0 x189 0 x1475 0} {cpMaster.to3 x1 0 x4 0 0 x64 0 x172 0 x189 0 x1475 0}}
- name offset3
- xpos 561
- ypos -211
- }
- Transform {
- inputs 0
- center {{cpMaster.to2 x1 0 x64 0 x65 0 x172 0 x189 0 x295 0 x313 0 x1475 0} {cpMaster.to2 x1 0 x64 0 x65 0 x172 0 x189 0 x295 0 x313 0 x1475 0}}
- name offset2
- xpos 570
- ypos -108
- }
- Roto {
- inputs 0
- curves {{{v x3f99999a}
- {f 0}
- {n
- {layer Root
- {f 512}
- {t x44700000 x44070000}
- {a}
- {curvegroup Bezier1 512 bezier
- {{cc
- {f 8192}
- {p
- {}
- {{=cpOutput.to4 x43870000}
- {=cpOutput.to4 x441b8000}}
- {}
- {}
- {{=cpOutput.to3 x44358000}
- {=cpOutput.to3 x44410000}}
- {}
- {}
- {{=cpOutput.to2 x446e8000}
- {=cpOutput.to2 x43c50000}}
- {}
- {}
- {{=cpOutput.to1 x43d70000}
- {=cpOutput.to1 x43480000}}
- {}}}
- {cc
- {f 8192}
- {p
- {}
- {}
- {}
- {}
- {}
- {}
- {}
- {}
- {}
- {}
- {}
- {}}}}
- {t x4414c000 x43f88000}
- {a spx 0 spy 0 sb 1 tt x40800000}}}}}}
- toolbox {selectAll {
- { selectAll str 1 ssx 1 ssy 1 sf 1 }
- { createBezier str 1 ssx 1 ssy 1 sf 1 sb 1 tt 4 }
- { createBezierCusped str 1 ssx 1 ssy 1 sf 1 sb 1 }
- { createBSpline str 1 ssx 1 ssy 1 sf 1 sb 1 tt 5 }
- { createEllipse str 1 ssx 1 ssy 1 sf 1 sb 1 tt 6 }
- { createRectangle str 1 ssx 1 ssy 1 sf 1 sb 1 tt 7 }
- { createRectangleCusped str 1 ssx 1 ssy 1 sf 1 sb 1 }
- { brush str 1 ssx 1 ssy 1 sf 1 sb 1 }
- { eraser src 2 str 1 ssx 1 ssy 1 sf 1 sb 1 }
- { clone src 1 str 1 ssx 1 ssy 1 sf 1 sb 1 }
- { reveal src 3 str 1 ssx 1 ssy 1 sf 1 sb 1 }
- { dodge src 1 str 1 ssx 1 ssy 1 sf 1 sb 1 }
- { burn src 1 str 1 ssx 1 ssy 1 sf 1 sb 1 }
- { blur src 1 str 1 ssx 1 ssy 1 sf 1 sb 1 }
- { sharpen src 1 str 1 ssx 1 ssy 1 sf 1 sb 1 }
- { smear src 1 str 1 ssx 1 ssy 1 sf 1 sb 1 }
- } }
- toolbar_autokey false
- toolbar_brush_hardness 0.200000003
- toolbar_source_transform_scale {1 1}
- toolbar_source_transform_center {320 240}
- colorOverlay 0
- lifetime_type "all frames"
- view {}
- motionblur_on true
- motionblur_shutter_offset_type centred
- source_translate_round false
- source_black_outside true
- createNewTrack {{-1} "-1\t(none)\t-1" "1000\tNew Track Layer\t1000"}
- name Roto1
- selected true
- xpos 860
- ypos -155
- }
- end_group
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement