// // lightConeColorToTransform // // august 13 2009 // clinton reese // // motion object lscript to take the selected light color and cone angle and assign it's values // to the rotation and position of a null // heading pitch and roll will each contain the spot angle of the light // position xyz and scale xyz comes from light color rgb // // after activate this script set animation key for null at frame zero then use motion baker motion modifier // choose x,y,z heading pitch roll Use Existing and under preferences do not use play at exact rate // play the animation to bake the keys // note that the collada // signs negated here so angle and color numbers are positive in the collada import for after effects // spot angle must be keyed to be read // @version 2.3 theLight; c; myscale = 0.01; oldlight = nil; create: obj { theLight = Light(); c = theLight.firstChannel(); while(c) { last if c.name == "ConeAngle"; c = theLight.nextChannel(); } setdesc("Light Attr Motion Mod"); } process: ma, frame, time { //spotangle = 2.0*theLight.coneangles[1]; spotangle = 1.0; if(c) { spotangle = 2.0*c.value(time); spotangle = spotangle * 180/3.14159; } theColor = theLight.color(time); //hpb = yxz ma.set(ROTATION,); ma.set(POSITION,); ma.set(SCALING,theColor/100);//after effects mult by 100 on collada import } options { var2 = nil; reqbegin("Light Attr to null"); reqsize(244,120); c1 = ctllightitems("LightItems",var2); ctlposition(c1,25,15); return if !reqpost(); var2 = getvalue(c1); if(var2!=nil) { theLight = var2; setdesc("Light data from ",theLight.name); c = theLight.firstChannel(); while(c) { last if c.name == "ConeAngle"; c = theLight.nextChannel(); } if(oldlight == nil || oldlight !=theLight) { scene = Scene(); sel = scene.firstSelect(); thename = theLight.name + "_LITKF"; AddNull(thename); PositionItem(sel.name); XController(7); YController(7); ZController(7); RotationItem(sel.name); HController(7); PController(7); BController(7); ScaleItem(sel.name); SXController(7); SYController(7); SZController(7); oldlight = theLight; } } reqend(); }