// // camFOVtoTransform // // august 13 2009 // clinton reese // // copy to ...\Plugins\lscripts\animate folder // motion object lscript to take the selected camera fov and assign it's fov // to the rotation of a null // also computes the denominator value for after effects camera zoom value // which would be multiplied by the ae comp height or width to get the zoom value // after activate this script on the null // double click for ui, choose the camera, set collada export scale and a new null created for motion baking // add motion baker motion modifier // choose x,y, heading and pitch Use Existing and under preferences do not use play at exact rate // play the animation to bake the keys // note that the collada rotation x has x fov and rotation z has the y fov, translation x is x z is y // signs negated here so numbers positive in the collada file // import to after effects with scale = 1, pick whip the zoom and mult by comp height // @version 2.3 cam; first; second; myscale = 0.01; oldcam = nil; create: obj { cam = Camera(); setdesc("FOV Motion Mod"); } process: ma, frame, time { theVal = cam.fovAngles(time); horiz = theVal[1]*180/3.14159; vert = theVal[2]*180/3.14159; zoominv = 2.0*tan(0.5*theVal[1]); zoomhoriz = 1.0/zoominv * 0.01/myscale; zoominv = 2.0*tan(0.5*theVal[2]); zoomvert = 1.0/zoominv * 0.01/myscale; ma.set(POSITION,); ma.set(ROTATION,<0,-horiz,-vert>); } options { var2 = nil; //myscale = 0.01; reqbegin("Camera attr to null"); reqsize(244,120); c1 = ctlcameraitems("CameraItems",var2); ctlposition(c1,25,15); c5 = ctlnumber("Export Scale",myscale); ctlposition(c5,25,40); return if !reqpost(); var2 = getvalue(c1); myscale = getvalue(c5); if(var2!=nil) { cam = var2; setdesc("FOV from ",cam.name); if(oldcam == nil || oldcam != cam) { scene = Scene(); sel = scene.firstSelect(); thename = cam.name + "_FOVKF"; AddNull(thename); PositionItem(sel.name); XController(7); YController(7); ZController(7); RotationItem(sel.name); HController(7); PController(7); BController(7); oldcam = cam; } } reqend(); }