// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== ////////////////////////////////////////////////////////////////////////////////////////////////// // // // fltLightsOnCurve.mel // // // ////////////////////////////////////////////////////////////////////////////////////////////////// // // // // // // // // Creation Date: ( 3/14/2002 ) // Last Update: ( 3/14/2002 ) // // Description: This script will place openFlight lights equadistantly apart on a selected curve // // Usage: fltLightsOnCurve ; // // Notes: You must have the openFlight plugin loaded in order for this script to work // // Input Arguments: integer representing number of lights desired // ////////////////////////////////////////////////////////////////////////////////////////////////// // // // Version: Maya 4.0 // // // ////////////////////////////////////////////////////////////////////////////////////////////////// global proc fltLightsOnCurve (int $numLights, float $red, float $green, float $blue) { // get selection // $selected = `ls -sl`; $curve = $selected[0]; // qualify the selection // if ($curve != ""){ $shapeNode = `listRelatives -shapes $curve`; if (`nodeType $shapeNode` == "nurbsCurve"){ // change the parameterization from 0 to 1 // rebuildCurve -ch 1 -rpo 1 -rt 4 -end 1 -kr 0 -kcp 0 -kep 1 -kt 0 -s 0 -d 3 -tol 0.01 $curve; // calculate the distance between each light // float $unitPosition = 0.9999999999 / ($numLights - 1); // initialize arcLength variable to increment current light position in loop // float $currentPos = 0; string $vtxSelection; $lightName = `fltLightPoints -c $numLights -clr $red $green $blue`; // create lights // // light creation and placement loop // for ($i = 0; $i < $numLights; $i++){ $vtxSelection = $lightName + ".vtx[" + $i + "]"; $pos = `pointOnCurve -pr $currentPos $curve`; // get xyz coordinate for next position on curve // move -xyz $pos[0] $pos[1] $pos[2] $vtxSelection; // place the light on the next position on curve // $currentPos += $unitPosition; // increment the curve position for next light placement // } } else warning (uiRes("m_fltLightsOnCurve.kInvalidSelection")); } else warning (uiRes("m_fltLightsOnCurve.kNoCurveSelected")); }