// =========================================================================== // 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. // =========================================================================== // // // // // // createCurveField // // // None. // // // This command creates a volume axis field with a curve connected to it. // If a curve is selected when the field is created it is used, otherwise // a new curve is generated. // // // None. // // // createCurveField; // global proc createCurveField() { string $curves[] = `ls -sl -dag -type nurbsCurve`; string $sel[] = `ls -sl`; string $objs[]; int $numObjs=0; int $i; int $numSel = size($sel); // remove the curves from the selection for( $i = 0; $i < $numSel; $i++ ){ string $crvs[] = `ls -dag -type nurbsCurve $sel[$i]`; if( 0 == size( $crvs )){ $objs[$numObjs] = $sel[$i]; $numObjs++; } } if($numSel != $numObjs ){ select $objs; } VolumeAxis; $sel = `ls -sl -dag -type volumeAxisField`; if( size($sel ) < 1 ){ return; } string $field = $sel[0]; string $curve; if( size($curves) > 0){ $curve = $curves[0]; } else { $curve = `curve -d 3 -p -4 0 0 -p -2 0 0 -p 0 0 0 -p 2 0 0 -p 4 0 0 -k 0 -k 0 -k 0 -k 1 -k 2 -k 2 -k 2 `; } setAttr ($field + ".volumeShape") 7; setAttr ($field + ".awayFromAxis") 0; setAttr ($field + ".alongAxis") 0.5; setAttr ($field + ".directionalSpeed") 0.0; connectAttr ($curve + ".worldSpace[0]") ($field + ".inputCurve"); }