// Scirpt not to be used without permission // Copyright Daniel Lowenberg ©2007 // http://www.3dvfx.com global proc createLightSphere(){ string $sphereName = stringArrayToString(`ls -selection`," "); print $sphereName; if ($sphereName != "") { string $locator = stringArrayToString(`spaceLocator -p 0 0 0`," "); int $vertexCount[] =`polyEvaluate -v $sphereName`; int $i; for ($i =0 ; $i < $vertexCount[0] ; $i++) { select -r ($sphereName + ".vtx[" + $i + "]"); // Get Vertex Position float $coords[] = `xform -ws -q -t ($sphereName + ".vtx[" + $i + "]")`; string $spotlight=`spotLight -rs 1`; string $lightParent[]; $lightParent = `listRelatives -p $spotlight`; print ($lightParent ); //parent -add ("spotLight" + $i) lightSphereGroup ; setAttr ($lightParent[0] + ".scaleX") .2; setAttr ($lightParent[0] + ".scaleY") .2; setAttr ($lightParent[0] + ".scaleZ") .2; // Move spotlight to Vertex setAttr ($lightParent[0] + ".translateX") $coords[0]; setAttr ($lightParent[0] + ".translateY") $coords[1]; setAttr ($lightParent[0] + ".translateZ") $coords[2]; select -r $locator $lightParent; aimConstraint -offset 0 0 0 -weight 1 -aimVector 0 0 -1 -upVector 0 0 0 -worldUpType "vector" -worldUpVector 0 1 0; //select pSolid1.cp[$i]; } group -em -n lightSphereGroup ; //add attributes //addAttr -ln inten -at long |lightSphereGroup; //setAttr -e -keyable true |lightSphereGroup.intensity; for ($i =1 ; $i < $vertexCount[0] + 1; $i++) { parent -relative ("spotLight" + $i) lightSphereGroup ; // connectAttr ("spotLight" + $i + ".intensity") lightSphereGroup.intensity; } } else { confirmDialog -title "Confirm" -message "select a solid first" -button "ok"; } }