This gizmo corvert a 3d data to 2d position, create AE keyframe data. to work with Optical Flares.
source code to copy paste on nuke node graph:
Code:
set cut_paste_input [stack 0]
version 6.2 v3
push $cut_paste_input
Group {
name NukeToOpticalFlares
help "1-Retime your sequence after this gizmo\nex. 100-360 ------- 0-260\n\n2-Put the width format of your project\nex. 1080, 1556, etc\n\n3-Clink on Create Keyframes this allowed to convert 3d information to 2d\n(if dont work go to node tab click on copy to group open reconcile3D1 and press create keyframes)\n\n4-Click on Bake your animation this bake your keyframe data frame by frame\n(if dont work click on animation menu then right click--->Edit---->Generate-->ok)\n\n5-Open the script editor and press TrackData\n(make sure that you have selected tracker1)\n\n6-Copy track data\n\n7-go to AE create a adjusment layer open optical flares pulldown the options \neffects--->optical flares and select Position XY and pasted (make sure that you pasted on the first frame)\n\n@b;\[you can help using it and making it better]\n\n@b;BY:JOHAN ROMERO"
selected true
xpos -383
ypos -135
addUserKnob {20 User l NukeToOpticalFlares}
addUserKnob {26 Format l "@b;Format"}
addUserKnob {3 format l "width Format" t "HD=1080\n2K=1556\n..etc"}
format 1080
addUserKnob {26 "" l "@b;Output:"}
addUserKnob {41 track1 T Tracker1.track1}
addUserKnob {22 createkeyframes2 l "create keyframes" t "Convert 3d position of the axis to 2d position useful to optical flares" -STARTLINE T "\[Reconcile3D1.createKeyframes]"}
addUserKnob {22 bake l "Bake Animation" t "Bake Keyframes Animation to be exported" T "# Bake Expressions\n# By Nathan Rusch\n# Updated August 23, 2010\n\nimport nuke\nimport re\n\ndef bakeExpressions(startFrame = nuke.root().firstFrame(), endFrame = nuke.root().lastFrame()):\n\t'''\n\tBakes all expression-driven knobs/knob components to keyframes over given input range\n\tTo Do:\n\t- Add support for multiple views\n\t'''\n\n\tif not nuke.selectedNodes():\n\t\treturn\n\tfor node in nuke.selectedNodes():\n\t\tfor knob in node.knobs().values():\n\t\t\tif knob.hasExpression():\n\t\t\t\tif knob.singleValue():\n\t\t\t\t\taSize = 1\n\t\t\t\telse:\n\t\t\t\t\taSize = knob.arraySize()\n\t\t\t\tfor index in range(aSize):\n\t\t\t\t\tif knob.hasExpression(index):\n\t\t\t\t\t\tanim = knob.animation(index)\n\t\t\t\t\t\tf = startFrame\n\t\t\t\t\t\twhile f <= endFrame:\n\t\t\t\t\t\t\tknob.setValueAt(anim.evaluate(f), f, index)\n\t\t\t\t\t\t\tf += 1\n\t\t\t\t\t\tknob.setExpression(\"curve\", index)\n\t\t\t\t\t\tif knob.animation(index).constant():\n\t\t\t\t\t\t\tknob.clearAnimated(index)\n\n\ndef expressBaker():\n\t'''\n\tGUI wrapper for bakeExpressions function\n\t'''\n\n\tinput = nuke.getFramesAndViews(\"Range to Bake\", \"%d-%d\" % (nuke.root().firstFrame(), nuke.root().lastFrame()))\n\trange = input\[0]\n\tif not re.match(\"^\\d+-\\d+\$\", range):\n\t\treturn\n\tfirst, last = range.split(\"-\")\n\tbakeExpressions(int(first), int(last))" +STARTLINE}
addUserKnob {26 Export l "@b;Export Tracking Data"}
addUserKnob {22 button l TrackData t "1-open the script editor then press export and copy pase to the position tab on the optical flares" T "sn = nuke.selectedNode()\n\nif sn.Class() != \"Tracker3\":\n nuke.message(\"This script only runs on a Tracker node.\")\n\nfps = nuke.root().fps()\nff = nuke.root().firstFrame()\nlf = nuke.root().lastFrame()\n\nheaderstart = \"Adobe After Effects 6.5 Keyframe Data\"\nw = nuke.value(sn.name() + \".bbox.w\")\nh = nuke.value(sn.name() + \".bbox.h\")\n\nprint headerstart\nprint\nprint \"\\tUnits Per Second\\t\" + str(fps)\nprint \"\\tSource Width\\t\" + str(w)\nprint \"\\tSource Height\\t\" + str(h)\nprint \"\\tSource Pixel Aspect Ratio\\t1\"\nprint \"\\tComp Pixel Aspect Ratio\\t1\"\nprint\nprint \"Position\"\nprint \"\\tFrame\\tX pixels\\tY pixels\\tZ pixels\"\n\nfor fr in range(ff, lf):\n print \"\\t\" + str(fr) + \"\\t\" + str(sn.knob(\"track1\").valueAt(fr,0)) + \"\\t\" + str(sn.knob(\"track1\").valueAt(fr,1)) + \"\\t0\"\n\nprint \"End of Keyframe Data\"" +STARTLINE}
addUserKnob {26 ""}
addUserKnob {26 "" l "@b;2D transform:"}
addUserKnob {41 track T Reconcile3D1.track}
addUserKnob {41 offset T Reconcile3D1.offset}
addUserKnob {26 "" l " "}
addUserKnob {41 stabilize T Reconcile3D1.stabilize}
addUserKnob {41 filter T Reconcile3D1.filter}
addUserKnob {41 clamp T Reconcile3D1.clamp}
addUserKnob {41 black_outside l "black outside" T Reconcile3D1.black_outside}
addUserKnob {41 motionblur T Reconcile3D1.motionblur}
addUserKnob {41 shutter T Reconcile3D1.shutter}
addUserKnob {41 shutteroffset l "shutter offset" T Reconcile3D1.shutteroffset}
addUserKnob {41 shuttercustomoffset l "" -STARTLINE T Reconcile3D1.shuttercustomoffset}
addUserKnob {26 ""}
addUserKnob {26 jr l "Created By @b; Johan Romero" T "you can help using it and making it better"}
addUserKnob {26 text2 l "" +STARTLINE T Johan149@hotmail.com}
}
Input {
inputs 0
name axis
xpos 180
ypos -11
number 2
}
Input {
inputs 0
name cam
xpos -25
ypos -11
}
Input {
inputs 0
name img
xpos 78
ypos -11
number 1
}
Retime {
name Retime1
xpos 78
ypos 13
}
Reconcile3D {
inputs 3
output {{curve} {"curve*(-1)+\[knob format]"}}
name Reconcile3D1
label "curve*(-1)+\[knob format]"
xpos 78
ypos 95
}
set N8ba63a0 [stack 0]
Output {
name Output1
xpos 78
ypos 216
}
push $N8ba63a0
Tracker3 {
track1 {{parent.Reconcile3D1.output} {parent.Reconcile3D1.output}}
offset1 {0 0}
pattern1 {-32 -32 32 32}
search1 {-22 -22 22 22}
track2 {1126 676}
offset2 {0 0}
pattern2 {-32 -32 32 32}
search2 {-22 -22 22 22}
track3 {1126 880}
offset3 {0 0}
pattern3 {-32 -32 32 32}
search3 {-22 -22 22 22}
track4 {922 880}
offset4 {0 0}
pattern4 {-32 -32 32 32}
search4 {-22 -22 22 22}
center {1024 778}
name Tracker1
selected true
xpos -22
ypos 108
}
end_group
HELP:
1-Retime your sequence after this gizmo
ex. 100-360 ——- 0-260
2-Put the width format of your project
ex. 1080, 1556, etc
3-Clink on Create Keyframes this allowed to convert 3d information to 2d
(if dont work go to node tab click on copy to group open reconcile3D1 and press create keyframes)
4-Click on Bake your animation this bake your keyframe data frame by frame
(if dont work click on animation menu then right click—>Edit—->Generate–>ok)
5-Open the script editor and press TrackData
(make sure that you have selected tracker1)
6-Copy track data
7-go to AE create a adjusment layer open optical flares pulldown the options
effects—>optical flares and select Position XY and pasted (make sure that you pasted on the first frame)
[you can help using it and making it better]
CREATED BY:JOHAN ROMERO
Johan149@hotmail.com