Creating a wave in one clilck by making own interface
//interface
if (`window -ex waveInterface`) {deleteUI -window waveInterface;}
window -title "My First Wave" -w 450 -h 300 waveInterface;
columnLayout;
floatSliderGrp -l "Width" -f 1 -min 5 -max 100.0 -fmn 5.0 -fmx 20.0 -v 10 waveWidth;
floatSliderGrp -l "Height" -f 1 -min 5 -max 100.0 -fmn 5.0 -fmx 20.0 -v 10 waveHeight;
floatSliderGrp -l "Frequency" -f 1 -min 0 -max 3.0 -fmn 0 -fmx 1.0 -v 1 waveFreq;
floatSliderGrp -l "Magnitude" -f 1 -min 0 -max 0.5 -fmn 0 -fmx 0.5 -v 0.05 -pre 2 -ss 0.01 waveMag;
floatSliderGrp -l "Conserve" -f 1 -min 0 -max 1 -fmn 0.9 -fmx 1.0 -v 0.95 -pre 2 -ss 0.01 waveConsv;
button -l "Create Wave !!" -w 450 -bgc 0.7 0.8 0.6 -c myWave;
showWindow waveInterface;
//----------------------------------------
proc myWave(){
//declaration
string $pPlane[],$softParticle[],$turb[];
float $widthW,$heightW,$freq,$mag,$conserveW;
//initialize
//----------------------------------------
$widthW=`floatSliderGrp -q -v waveWidth`;
$heightW=`floatSliderGrp -q -v waveHeight`;
$freq=`floatSliderGrp -q -v waveFreq`;
$mag=`floatSliderGrp -q -v waveMag`;
$conserveW=`floatSliderGrp -q -v waveConsv`;
//----------------------------------------
//operation
$pPlane=`polyPlane -w 1 -h 1 -sx 10 -sy 10 -ax 0 1 0 -cuv 2 -ch 1`;
setAttr ($pPlane[1]+".width") $widthW;
setAttr ($pPlane[1]+".height") $heightW;
setAttr ($pPlane[1]+".subdivisionsWidth") 30;
setAttr ($pPlane[1]+".subdivisionsHeight") 30;
$softParticle=`soft -c `;
select -r $softParticle[0];
$turb=`turbulence -pos 0 0 0 -m $mag -att 0 -f $freq -phaseX 0 -phaseY 0 -phaseZ 0 -noiseLevel 0 -noiseRatio 0.707 -mxd -1 -vsh none -vex 0 -vof 0 0 0 -vsw 360 -tsr 0.5 `;
connectDynamic -f $turb[0] $softParticle[0];
expression -s ($turb[0]+".phaseZ=time;") -o $turb[0] -ae 1 -uc all ;
setAttr ($turb[0]+".magnitude") .05;
select -r $softParticle[0];
particle -e -c $conserveW $softParticle[0];
select -r $pPlane[0] $turb[0];
group -n "myWave";}
No comments:
Post a Comment