/****************************************************************************************** Name: Fire Whirl User Interface Version: 9.2 Purpose: Create an UI window for generating a fire whirl with the help of the attributes provided in the UI. History: Ver Final (18 August) Change the algorithm of bone animation. Delete number of turns field in the interface. Ver 9.0~9.2 (14 August) Change back the UI Layout as frame Layout due to the appearance. In case of the possibility of using tab Layout in the future, 9.2 is saved as reference of tab Layout. (9.1 will be frame Layout version) Fire Animation and Whirl Animation section had been separated as two frames because the column is too long. Fire Shader changes and some controls added. Smoke is modified and its shader is added. Ver 8.0~8.2 (10 August) Change the UI Layout to tab Layout. Smoke is added again, but it is optional to user. Some of the controls had set to optional. Control which allow the user to set free key are added to fire whirl animation and transform attribute. The vortex model is modified. Ver 7.1 (3 August 2009) Further change of the interface and shader values Ver 7.0 (31 July 2009) Shader and transform attributes inserted. Curve attached particles deleted Ver 6.0 (28 July 2009) Curve Emitter is build as smoke. The ramps are edited. Ver 5.1 (23 July 2009) Particle Animation Keyframes added. Controls for Particle Animation are inserted in the UI. Ver 5.0 (17 July 2009) Correct the particle goal mistake in Vortex circle from Ver 4.0; Add particle goals to the curves. Ver 4.0 (15 July 2009) Add setKeyframe script to the vortex. Corresponding controls had been added. Ver 3.1 (13 July 2009) Curve emitter problem is solved. The UI layout has been changed. Ver 3.0 (12 July 2009) Further improved the script. The curves are parented to vortex circle.There are buttons added for selecting and deleting the Vortex Path. A emitter is successfully attached to vortex circle. Ver 2.0 (9 July 2009) Added the calculation of positioning the curves and change the UI design Ver 1.0 (5 July 2009) Create a simple vortex circle, curve path and simple UI with textField test Created by Magdalene T.W. Chan Reference for this script: MEL Scripting for Maya Animators (Mark R. Wilkins & Chris Kazmier, 2003), MEL Fundamental (Alias Wavefront,n.d.), Digital Tutors about Maya particles, Fluid and Mental Ray (Digital Tutors, 2007) Email: magdalene.chan@gmail.com *********************************************************************************************/ // "//XXX" or "/*XXX*/" is unused command line/procedure (function) // "//******XXX******" is explanation //*****Local variables for loops***** int $i; int $j; int $k; int $l; int $m; int $n; int $p; int $q; int $s; //*****The Local procedure (function) for building Vortex Circle***** proc vortexCircle() { //*****set the vortex circle radius***** float $Circlerad=`floatFieldGrp -q -v1 Vortex_radius`; //*****Name the vortex circle to "VortexCircle"***** string $Circlename="VortexCircle"; //*****model the nurbs circle***** circle -name $Circlename -c 0 0 0 -nr 0 1 0 -sw 360 -r $Circlerad -d 3 -ut 0 -tol 0.01 -s 8 -ch 1; //*****Create a emitter with particles for that circle***** emitter -type omni -name "Circle_emit#" -r 200 -pos 0 0 0; particle -n Circleparticle; connectDynamic -em Circle_emit1 Circleparticle; //*****set the Circleparticle attributes--RenderType and lifespanMode***** setAttr CircleparticleShape.particleRenderType 8; //***** Render Type is Cloud ***** setAttr CircleparticleShape.lifespanMode 3; //***** Life Span Mode is lifespanPP only***** //*****set particles goal to the circle***** goal -w 1 -utr 0 -g $Circlename Circleparticle; //*****add the relevant attributes--radius, goalU, goalV and goalOffset, for controlling the particles goal***** addAttr -is true -ln radius -at "float" -min 0 -max 1 -dv 0.3 CircleparticleShape; addAttr -ln goalU -dt doubleArray CircleparticleShape; addAttr -ln goalU0 -dt doubleArray CircleparticleShape; addAttr -ln goalV -dt doubleArray CircleparticleShape; addAttr -ln goalV0 -dt doubleArray CircleparticleShape; addAttr -ln goalOffset -dt vectorArray CircleparticleShape; addAttr -ln "Vortex_Radius" -sn "VR" -at "float" -min 0.1 -max 10 -dv 1 CircleparticleShape; //*****add the relevant attributes for controlling the particles size(radiusPP) and transparency(opacityPP)***** addAttr -ln opacityPP -dt doubleArray CircleparticleShape; addAttr -ln opacityPP0 -dt doubleArray CircleparticleShape; addAttr -ln radiusPP -dt doubleArray CircleparticleShape; addAttr -ln radiusPP0 -dt doubleArray CircleparticleShape; setAttr CircleparticleShape.VR $Circlerad; //*****add the expression for controlling goals***** dynExpression -s "goalU=0.0;\ngoalV=0.0;\ngoalOffset=0;" -c CircleparticleShape; dynExpression -s "lifespanPP=5;\ngoalU=age*VR*20-2;\ngoalV=age*VR*20-2;\ngoalOffset=sphrand(2);\nif (goalV>10 && goalU>10) {lifespanPP=0;}" -rbd CircleparticleShape; //*****add ramps to the array Mapper in the radiusPP and opacityPP of the Circleparticle***** arrayMapper -t CircleparticleShape -da radiusPP -iv ageNormalized -ty ramp; arrayMapper -t CircleparticleShape -da opacityPP -iv ageNormalized -ty ramp; select -add Circleparticle Circle_emit1 VortexCircle; parent; } //*****the Local procedure for building a single helix (vortex path)***** proc Helix() { //*****user-defined vortex radius redefine***** float $Circlerad=`floatFieldGrp -q -v1 Vortex_radius`; //*****define the vortexheight, it is user-defined***** float $VortexHeight=`floatFieldGrp -q -v1 Vortex_height`; //*****define x,y,z of the helix***** float $x=0, $y=0, $z=0; //*****define the numbers of CV for the helix***** int $num_CV=$VortexHeight*4; //*****set the first CV of the helix***** curve -d 3 -p 0 0 0 -k 0 -k 0 -k 0; //*****the curve name is defined as list selected, i.e. curve1, curve2...***** string $curve_name[]=`ls -sl`; //*****create the helix by using for loop***** for ($i=0; $i<$num_CV; $i++) { //*****z is defined by this equation: -a*cos(bx+c)***** $z=($Circlerad*2)*cos($i); //*****x is defined by this equation: a*sin(bx+c)***** $x=($Circlerad*2)*sin($i); //*****in order to locate the CV in upward direction, y=i***** $y=$i; //*****create the helix***** curve -os -a -p $x $y $z $curve_name; } } //*****the Local procedure for creating the smoke***** proc SmokeEmit() { //*****Vortex Circle Radius (user-defined)***** float $Circlerad=`floatFieldGrp -q -v1 Vortex_radius`; //*****Name of Smoke Emitter***** string $smokeemit="SmokeEmit"; //*****Name of Smoke particle***** string $smokeparticle="smokeparticle"; //*****Original ramp name***** string $originSmokeRamp="ramp1"; //*****Set the new name for smnoke radiusPP ramp***** string $newSmokeRamp="smokeramp"; //*****create Smoke Emitter***** emitter -n $smokeemit -type volume -r 500; //*****create Smoke particles***** particle -n $smokeparticle; //*****connect the Smoke emitter and particles together***** connectDynamic -em $smokeemit $smokeparticle; //*****add uniform field to Smokeparticle***** uniform -pos 0 0 0 -n "SmokeUni" -m 5 -att 0 -dx 0 -dy 1 -dz 0; connectDynamic -f SmokeUni $smokeparticle; //*****add vortex field to Smokeparticle***** vortex -pos 0 0 0 -n "Smokevortex" -m 2 -att 0; connectDynamic -f Smokevortex $smokeparticle; //*****set Smoke Emitter's attributes***** setAttr "SmokeEmit.volumeShape" 2; //*****Volume Shape is Cylinder***** setAttr "SmokeEmit.awayFromAxis" 0; //*****Away from Axis is 0***** setAttr "SmokeEmit.alongAxis" 1; //*****Along Axis is 1, so that the particles will move along that gizmo***** setAttr "SmokeEmit.scaleRateByObjectSize" 0; //*****Along Axis is 1, so that the particles will move along that gizmo***** //*****edit Smoke particles shape attributes***** setAttr "smokeparticleShape.lifespanMode" 2; //*****Life Span Mode is Random Range***** setAttr "smokeparticleShape.lifespan" 7; //*****Life span is 7***** setAttr "smokeparticleShape.lifespanRandom" 5; //*****Life Span Random is 5***** setAttr "smokeparticleShape.particleRenderType" 8; //*****set the particles to Cloud hardware rendering***** //*****add relevant attributes --radius, radius PP to the smoke particles ***** addAttr -is true -ln radius -at "float" -min 0 -max 1 -dv 0.2 smokeparticleShape; addAttr -ln radiusPP -dt doubleArray smokeparticleShape; addAttr -ln radiusPP0 -dt doubleArray smokeparticleShape; //*****create a ramp to radiusPP for controlling the transparency***** arrayMapper -t smokeparticleShape -da radiusPP -iv ageNormalized -ty ramp; //***** rename the ramp ***** rename $originSmokeRamp $newSmokeRamp; //*****insert the lifespan expression to runtime before dynamics expression***** dynExpression -s "lifespanPP=rand(1,3);" -rbd smokeparticleShape; //*****parent the smoke and the forces to vortex circle***** select -add $smokeemit $smokeparticle SmokeUni Smokevortex; select -tgl VortexCircle ; parent; select -cl; //*****move smoke emitter***** setAttr "SmokeEmit.ty" 2; setAttr "SmokeEmit.sx" (2*$Circlerad); setAttr "SmokeEmit.sy" (2*$Circlerad); setAttr "SmokeEmit.sz" (2*$Circlerad); //*****Edit Smoke RadiusPP Ramp***** setAttr "smokeramp.colorEntryList[0].position" 0; setAttr "smokeramp.colorEntryList[1].position" 0.2; setAttr "smokeramp.colorEntryList[2].position" 0.765; setAttr "smokeramp.colorEntryList[3].position" 1; setAttr "smokeramp.colorEntryList[0].color" -type double3 0 0 0; setAttr "smokeramp.colorEntryList[1].color" -type double3 1 1 1; setAttr "smokeramp.colorEntryList[2].color" -type double3 0.433 0.433 0.433; setAttr "smokeramp.colorEntryList[3].color" -type double3 0 0 0; } //*****the Local procedure for deleteing the smoke***** proc DeleteSmoke() { //*****define the smoke components name by using strings for selection***** string $smokeemit="SmokeEmit"; string $smokeparticle="smokeparticle"; $smokeparticle="smokeparticle"; string $SmokeRamp="smokeramp"; //*****select all the components and delete***** select -add $smokeemit $smokeparticle $SmokeRamp SmokeUni Smokevortex; doDelete; } //*****the Global procedure for deleteing the smoke***** global proc EnableSmoke(int $value3) { //*****create a variable as switch value, the value of that variable is the Boolean value of enable smoke check box***** $value3=`checkBox -q -v EnableSmoke`; //*****Using switch to determine the check box action***** switch ($value3) { //*****When the value is 0, the uniform and vortex force are unavailable, the smoke will be deleted if the smoke had existed***** case 0: floatFieldGrp -e -en 0 SmokeUni; floatFieldGrp -e -en 0 SmokeVortex; DeleteSmoke(); break; //*****When the value is 1, the uniform and vortex force are available, the smoke will be produced***** case 1: floatFieldGrp -e -en 1 SmokeUni; floatFieldGrp -e -en 1 SmokeVortex; SmokeEmit(); break; default: break; } } //*****the Local procedure for adding the forces to the particles***** proc addForce() { //*****define the numbers of vortex path***** int $CurveNum= `intFieldGrp -q -v1 Path_num`; //*****put the particles names as strings for dynamic connections***** string $Circleparticle="Circleparticle"; string $particle[]; //*****set the maximum limit (CurveNum max number=10) of the Vortex path Number***** if ($CurveNum>10) { $CurveNum=10; print "The Max value of path is 10."; } //*****add drag to Circleparticle***** drag -pos 0 0 0 -n "firedrag#" -m 10 -att 0 -dx 0 -dy 1 -dz 0; connectDynamic -f firedrag1 $Circleparticle; //*****add gravity to Circleparticle***** gravity -pos 0 0 0 -n "firegravity#" -m 9.8 -att 0 -dx 0 -dy 1 -dz 0; connectDynamic -f firegravity1 $Circleparticle; //*****add turbulence to Circleparticle***** turbulence -pos 0 0 0 -n "fireTurbul#" -m 10 -att 1; connectDynamic -f fireTurbul1 $Circleparticle; //*****connect other particles to the three forces using for loop***** for ($i=0; $i<$CurveNum; $i++) { $particle[$i]="curvep"+($i+1); connectDynamic -f firedrag1 $particle[$i]; connectDynamic -f firegravity1 $particle[$i]; connectDynamic -f fireTurbul1 $particle[$i]; } //*****add the expression for the turbulence phase Y***** expression -s "phaseY=noise (time)" -o fireTurbul1 -ae 1 -uc all; //*****set the default values for the forces***** setAttr "firedrag1.magnitude" 20; //*****Drag=20***** setAttr "firegravity1.magnitude" -9.8; //*****Gravity=-9.8***** setAttr "fireTurbul1.magnitude" 10; //*****Turbulence=10***** } //*****the Local procedure for setting ramp values to the circle particles***** proc rampvalueCircle() { //*****put all the ramp name to string arrays for editing***** string $Rampcircle[]; string $RampcircleColorpos[]; string $RampcircleColor[]; string $RampcircleColorpos2[]; string $RampcircleColor2[]; //*****setting the radiusPP ramp values for the circle particles using nested for loop***** for ($i=1; $i<=2; $i++) { $Rampcircle[$i]="circleramp"+$i; for ($k=0; $k<4; $k++) { //*****define the colorEntryList array position for a radiusPP ramp***** $RampcircleColorpos[$k]=$Rampcircle[1]+".colorEntryList["+$k+"]"+".position"; //*****define the colorEntryList array colour for a radiusPP ramp***** $RampcircleColor[$k]=$Rampcircle[1]+".colorEntryList["+$k+"]"+".color"; } //*****set the positions and colours for the radiusPP ramp***** setAttr $RampcircleColorpos[0] 0; setAttr $RampcircleColorpos[1] 0.08; setAttr $RampcircleColorpos[2] 0.195; setAttr $RampcircleColorpos[3] 1; setAttr $RampcircleColor[0] -type double3 0.395 0.395 0.395; setAttr $RampcircleColor[1] -type double3 0.255 0.255 0.255; setAttr $RampcircleColor[2] -type double3 0.357 0.357 0.357; setAttr $RampcircleColor[3] -type double3 0 0 0; } //*****setting the opacityPP ramp values for the circle particles using nested for loop***** for ($j=1; $j<=2; $j++) { $Rampcircle[$j]="circleramp"+$j; for ($l=0; $l<4; $l++) { //*****define the colorEntryList array position for a opacityPP ramp***** $RampcircleColorpos2[$l]=$Rampcircle[2]+".colorEntryList["+$l+"]"+".position"; //*****define the colorEntryList array colour for a opacityPP ramp***** $RampcircleColor2[$l]=$Rampcircle[2]+".colorEntryList["+$l+"]"+".color"; } //*****set the positions and colours for the opacityPP ramp***** setAttr $RampcircleColorpos2[0] 0; setAttr $RampcircleColorpos2[1] 0.08; setAttr $RampcircleColorpos2[2] 0.63; setAttr $RampcircleColorpos2[3] 0.83; setAttr $RampcircleColor2[0] -type double3 0.083 0.083 0.083; setAttr $RampcircleColor2[1] -type double3 0.338 0.338 0.338; setAttr $RampcircleColor2[2] -type double3 0.07 0.07 0.07; setAttr $RampcircleColor2[3] -type double3 0 0 0; } } //*****the Local procedure for setting ramp values to fire particles***** proc rampvalueParticle() { //*****define the numbers of vortex path***** int $CurveNum= `intFieldGrp -q -v1 Path_num`; //*****put all the particles name into string arrays for further editing***** string $PRamp[]; string $PRamp2[]; string $PRamp3; string $PRamp4; string $PRampColor[]; string $PRampColorpos[]; string $PRampColor2[]; string $PRampColorpos2[]; //*****set the filenumber with vortex path quantity***** float $filenumber=$CurveNum*2+2; //*****set the maximum limit (CurveNum max number=10) for the Vortex path number***** if ($CurveNum>10) { $CurveNum=10; $filenumber=22; print "The Max value of path is 10."; } //*****setting the radiusPP ramp values for fire particles using nested for loop***** for ($i=1; $i<=$CurveNum; $i++) { $PRamp[$i]="Particleramp"+($i*2+1); for ($k=0; $k<4; $k++) { //*****define the colorEntryList array position for radiusPP ramps***** $PRampColorpos[$k]=$PRamp[$i]+".colorEntryList["+$k+"]"+".position"; //*****define the colorEntryList array colour for radiusPP ramps***** $PRampColor[$k]=$PRamp[$i]+".colorEntryList["+$k+"]"+".color"; } //*****set the positions and colours for the radiusPP ramps***** setAttr $PRampColorpos[0] 0; setAttr $PRampColorpos[1] 0.1; setAttr $PRampColorpos[2] 0.66; setAttr $PRampColorpos[3] 1; setAttr $PRampColor[0] -type double3 0.357 0.357 0.357; setAttr $PRampColor[1] -type double3 0.8 0.8 0.8; setAttr $PRampColor[2] -type double3 0.185 0.185 0.185; setAttr $PRampColor[3] -type double3 0 0 0; } //*****setting the opacityPP ramp values for fire particles using nested for loop***** for ($j=1; $j<=$CurveNum; $j++) { $PRamp2[$j]="Particleramp"+($j*2+2); for ($l=0; $l<4; $l++) { //*****define the colorEntryList array position for opacityPP ramps***** $PRampColorpos2[$l]=$PRamp2[$j]+".colorEntryList["+$l+"]"+".position"; //*****define the colorEntryList array colour for opacityPP ramps***** $PRampColor2[$l]=$PRamp2[$j]+".colorEntryList["+$l+"]"+".color"; } //*****set the positions and colours for the opacityPP ramps***** setAttr $PRampColorpos2[0] 0; setAttr $PRampColorpos2[1] 0.105; setAttr $PRampColorpos2[2] 0.4; setAttr $PRampColorpos2[3] 0.5; setAttr $PRampColor2[0] -type double3 0.37 0.37 0.37; setAttr $PRampColor2[1] -type double3 1 1 1; setAttr $PRampColor2[2] -type double3 0.618 0.618 0.618; setAttr $PRampColor2[3] -type double3 0 0 0; } } //*****the global procedure for creating the fire whirl model***** global proc CreateVortex() { //*****set the playback option from 0 frame to 100 frames when the fire whirl is created***** playbackOptions -min 0 -max 100; //*****make the cycle check off in case of error message appears***** cycleCheck -e off; //*****make the vortex circle first***** vortexCircle(); //*****fire emitters name***** string $emitname[]; //*****fire particles name***** string $particle[]; //*****vortex path name***** string $curvename[]; //*****fire particles(+Shape) name***** string $pShapeName[]; //*****fire particles(+Shape).lifespanMode***** string $lifeMode[]; //*****fire particles(+Shape).RenderType***** string $Rendertype[]; //*****fire particles(+Shape).lifespan***** string $LifeSpan[]; //*****original particles radiusPP & opacityPP ramps' name***** string $originRamp[]; string $originRampcircle[]; string $originRampfire[]; //*****new particles radiusPP & opacityPP ramps' name***** string $newRamp[]; string $newRampcircle[]; string $newRampfire[]; //*****define vortex path height***** float $VortexHeight=`floatFieldGrp -q -v1 Vortex_height`; //*****define vortex circle radius***** float $Circlerad=`floatFieldGrp -q -v1 Vortex_radius`; //*****define vortex path number***** int $CurveNum= `intFieldGrp -q -v1 Path_num`; //*****define Flow Speed***** float $FlowSp=`floatFieldGrp -q -v1 FS`; float $FlowSpOffset=`floatFieldGrp -q -v1 FFSO`; //*****define vortex path position--cx,cz***** float $cx, $cz; //*****define vortex path position--cx,cz***** string $curve_name[]=`ls -sl`; //*****set the filenumber with vortex path quantity***** float $filenumber=$CurveNum*2+2; //*****set the maximum limit (CurveNum max number=10) to the Vortex path number***** if ($CurveNum>10) { $CurveNum=10; $filenumber=22; print "The Max value of path is 10."; } //*****allocate the vortex path to the vortex circle evenly***** for ($i=0; $i<$CurveNum; $i++) { //*****set the angle with vortex path number for placing multiple path on the right place***** float $angle= 2*3.14/$CurveNum*$i; //float $A= `pow (-1) ($i+1)`; //*****using the equation Rcos(theta) & Rsin(theta) for positioning the vortex path***** $cx=$Circlerad*cos($angle); $cz=$Circlerad*sin($angle); //*****draw the single vortex path***** Helix(); //*****locate the vortex paths' positions***** move $cx 0 $cz; //*****rotate the paths' direction***** //rotate 0 (180*($i+1)+($A)*(-20)+(($i+$CurveNum)*2*(20*$i))) 0; //*****set the relation between the angle of the rotation and the vortex path numbers ***** //*****if there is one Vortex path in the scene, rotate 200 degrees in Y axis***** if ($CurveNum==1) { rotate 0 200 0; } //*****if there are twp Vortex paths in the scene, rotate all the vortex paths by this formula: (200*($i+1)-20) ***** if ($CurveNum==2) { rotate 0 (200*($i+1)-20) 0;} //*****if there are three or more than three Vortex paths in the scene, rotate all the vortex paths by this formula: (200*($i+1)+((($CurveNum-1)*$i)*20)) ***** if ($CurveNum>=3) { rotate 0 (200*($i+1)+((($CurveNum-1)*$i)*20)) 0; } //*****if there are six or more than six Vortex paths in the scene, rotate all the vortex paths by this formula: (200*($i+1)+((5*$i)*20)+(($i+1)*10)) ***** if ($CurveNum>=6) { //******specially set curve 1 rotation***** if ($i==0) { rotate 0 200 0; } else{ rotate 0 (200*($i+1)+((5*$i)*20)+(($i+1)*10)) 0;} } //*****if there are eight or more than eight Vortex paths in the scene, rotate all the vortex paths by this formula: (200*($i+1)+((5*$i)*20)+(($i+1)*20)) ***** if ($CurveNum>8) { //******specially set curve 1 rotation***** if ($i==0) { rotate 0 200 0; } else{ rotate 0 (200*($i+1)+((5*$i)*20)+(($i+1)*20)) 0;} } //*****set the emitter and particles name and attributes in the for loop ***** $emitname[$i]="emit"+($i+1); $curvename[$i]="curve"+($i+1); $particle[$i]="curvep"+($i+1); $pShapeName[$i]=$particle[$i]+"Shape"; $lifeMode[$i]=$pShapeName[$i]+".lifespanMode"; $Rendertype[$i]=$pShapeName[$i]+".particleRenderType"; $LifeSpan[$i]=$pShapeName[$i]+".lifespan"; //*****create the emitters with the particles***** emitter -type omni -n $emitname[$i] -r 200 -cyi 1 -spd 0.342 -nsp 0.513 -tsp 5.043 -mxd 0 -mnd 0 -dx 0 -dy 0.5 -dz 0 -sp 0; particle -n $particle[$i]; connectDynamic -em $emitname[$i] $particle[$i]; //*****set particles goal***** goal -w 1 -utr 0 -g $curvename[$i] $particle[$i]; //*****edit fire particles' attributes***** setAttr $lifeMode[$i] 3; //*****lifespanMode lifespanPPonly***** setAttr $Rendertype[$i] 8; //*****Rendertype Cloud***** setAttr $LifeSpan[$i] 2; //*****Lifespan=2***** //*****add Flow Speed attribute to control the particles goal speed***** addAttr -ln "FlowSpeed" -sn "FS" -at "float" -min 1 -dv 12 $pShapeName[$i]; //*****add Vortex Radius attribute for particles animation***** addAttr -ln "Vortex_Radius" -sn "VR" -at "float" $pShapeName[$i]; //*****add Vortex Height attribute with the min number 1, for setting the min number and particles animation***** addAttr -ln "Vortex_Height" -sn "VH" -at "float" -min 1 -dv 1 $pShapeName[$i]; //*****add Flow Speed Offset attribute for particles animation, to shift the particles****** addAttr -ln "FlowSpeed_Offset" -sn "FSO" -at "float" -min -50.0 -max 50.0 -dv 0.1 $pShapeName[$i]; //*****set a variable for defining Vortex Radius value****** float $CR=$Circlerad; //*****name the attributes with $pShape, e.g. curvep1Shape.FS***** string $pShapeFlowspeed[]; string $pShapeCR[]; string $pShapeVH[]; string $pShapeFSO[]; //***** $pShape+.FS, Flow Speed***** $pShapeFlowspeed[$i]=$pShapeName[$i]+".FS"; //***** $pShape+.VH, Vortex Height***** $pShapeVH[$i]=$pShapeName[$i]+".VH"; //***** $pShape+.VR, Vortex Radius***** $pShapeCR[$i]=$pShapeName[$i]+".VR"; //***** $pShape+.FSO, Flow Speed Offset***** $pShapeFSO[$i]=$pShapeName[$i]+".FSO"; //*****set the new attributes for particles animation***** setAttr $pShapeFlowspeed[$i] $FlowSp; //*****Flow Speed is user-defined***** setAttr $pShapeCR[$i] $CR; //*****Vortex Radius is user-defined***** setAttr $pShapeVH[$i] $VortexHeight; //*****Vortex Height is user-defined***** setAttr $pShapeFSO[$i] $FlowSpOffset; //*****Flow Speed Offset is user-defined***** //*****expression script for runtime (before dynamics) expression: //*****lifespan is defined by Vortex Radius. LifespanPP is animated by //*****the formula which is originally set for Maya Fire Effect System, which is //*****(dnoise(position*0.5*scale+(-3)*time)+0.9)*lifespan. //*****Goal U & V is set as age*Flow Speed-Flow Speed Offset. //*****Goal Offset is defined as sphere random (Vortex Radius x 2). //***** If Goal U & V reach on a specific point, lifespanPP will be 0, the particles will //***** not generate after this point. ***** string $FWexpr="lifespan=VR;\nlifespanPP=(dnoise(position*0.5*0.5+(-3)*time)+0.9)*lifespan;\ngoalU=age*FS-FSO;\ngoalV=age*FS-FSO;\ngoalOffset=sphrand(VR*2);\nif (goalV>FS && goalU>FS) {lifespanPP=0;}"; //*****add the relevant attributes--goalU,goalV,goalOffset,radius,radiusPP,opacityPP to the fire particles***** addAttr -is true -ln radius -at "float" -min 0 -max 1 -dv 0.3 $pShapeName[$i]; addAttr -ln goalU -dt doubleArray $pShapeName[$i]; addAttr -ln goalU0 -dt doubleArray $pShapeName[$i]; addAttr -ln goalV -dt doubleArray $pShapeName[$i]; addAttr -ln goalV0 -dt doubleArray $pShapeName[$i]; addAttr -ln goalOffset -dt vectorArray $pShapeName[$i]; addAttr -ln opacityPP -dt doubleArray $pShapeName[$i]; addAttr -ln opacityPP0 -dt doubleArray $pShapeName[$i]; addAttr -ln radiusPP -dt doubleArray $pShapeName[$i]; addAttr -ln radiusPP0 -dt doubleArray $pShapeName[$i]; //*****add the expression for controlling goals and particles animation***** dynExpression -s "goalU=0;\ngoalV=0;" -c $pShapeName[$i]; dynExpression -s $FWexpr -rbd $pShapeName[$i]; //*****add array Mapper for the radius and opacityPP***** arrayMapper -t $pShapeName[$i] -da radiusPP -iv ageNormalized -ty ramp; arrayMapper -t $pShapeName[$i] -da opacityPP -iv ageNormalized -ty ramp; } //*****add the forces to the fire particles***** addForce(); //*****parent the forces, curves, emitters and particles to the vortex circle***** for ($j=0; $j<$CurveNum; $j++) { $emitname[$j]="emit"+($j+1); $curvename[$j]="curve"+($j+1); $particle[$j]="curvep"+($j+1); //*****select the emitters, particles, the curves and the forces***** select -add $emitname[$j] $curvename[$j] $particle[$j] firedrag1 firegravity1 fireTurbul1; } //*****then select the Vortex Circle and parent the selected components to the Circle***** select -tgl VortexCircle; parent; //*****cancel selection***** select -cl; //*****rename the ramps***** for ($k=1; $k<=2; $k++) { $originRampcircle[$k]="ramp"+$k; $newRampcircle[$k]="circleramp"+$k; rename $originRampcircle[$k] $newRampcircle[$k]; } for ($j=3; $j<=$filenumber; $j++) { $originRamp[$j]="ramp"+$j; $newRamp[$j]="Particleramp"+$j; rename $originRamp[$j] $newRamp[$j]; } //*****edit the ramps' values***** rampvalueCircle(); rampvalueParticle(); //*****edit the buttons: Create button will disable after the creation, Select Vortex button will enable***** button -e -en 0 Vortexbutton; button -e -en 1 SelectVortex; } //*****the Local procedure for add bones (animation skeleton) to the whirl***** proc Addbone() { //*****define vortex path height***** float $VortexHeight=`floatFieldGrp -q -v1 Vortex_height`; //*****set the string variable for the bones' names for selection***** string $Jname[]; //*****develop and bind the bones to the whirl***** for ($i=0; $i<($VortexHeight*2); $i++) { //*****name the bones as FJ1, FJ2....***** $Jname[$i]="FJ"+($i+1); //*****build the bones with the increasing height=ix2+0.2***** joint -p 0 ($i*2+0.2) 0 -n $Jname[$i]; joint -e -zso -oj xyz -sao yup -n $Jname[$i]; } //*****bind the bones to the whirl***** bindSkin FJ1 VortexCircle; //*****parent the bone to the Vortex Circle, note that there will be an error //*****said that the bone is already the child of the circle, because bind skin //*****take the action first. The following action just want to attach the bone to vortex circle.***** select -r FJ1; select -tgl VortexCircle; parent; select -cl; } //*****the Local procedure for delete bones (animation skeleton) in the whirl***** proc Deletebone() { //*****define the Curve number for bone selection***** int $CurveNum= `intFieldGrp -q -v1 Path_num`; //*****group the curve name into a string array***** string $curvename[]; //*****select the bone***** select -r FJ1; //*****select all vortex paths***** for ($i=0; $i<$CurveNum; $i++) { $curvename[$i]="curve"+($i+1); select -add $curvename[$i]; } //*****lastly select the vortex circle***** select -add VortexCircle ; //*****detach skin***** doDetachSkin "2" {"1","1"}; //*****cancel selection***** select -cl; //*****select the bone and delete it***** select -r FJ1; doDelete; } //*****the global procedure for Enable Bone in the User Interface***** global proc EnableBone(int $state5) { //*****create a variable for switch value. The value is the Boolean value of enable bone check box***** $state5=`checkBox -q -v CBB`; switch ($state5) { //*****if state5=0, the whirl animation controls are unavailable, the bone will be deleted if it is existed***** case 0: floatFieldGrp -e -en 0 Spin_Speed; floatFieldGrp -e -en 0 Spin_Vel; floatFieldGrp -e -en 0 Spin_Radius1; floatFieldGrp -e -en 0 Spin_Radius2; button -e -en 0 AnimateB; button -e -en 0 DeleteB; Deletebone(); break; //*****if state5=1, the whirl animation controls are available, the bone will be created***** case 1: floatFieldGrp -e -en 1 Spin_Speed; floatFieldGrp -e -en 1 Spin_Vel; floatFieldGrp -e -en 1 Spin_Radius1; floatFieldGrp -e -en 1 Spin_Radius2; button -e -en 1 AnimateB; button -e -en 1 DeleteB; Addbone(); break; //*****no default setting for the switch function***** default: break; } } //*****the global procedure for deleting the fire whirl***** global proc DeleteVortex() { //*****define the numbers of the vortex path for selection***** int $CurveNum= `intFieldGrp -q -v1 Path_num`; //*****define the total filenumber***** float $filenumber=$CurveNum*2+2; //*****the string arrays of the circle and fire particles***** string $Ramp[]; string $Rampcircle[]; //*****create these variable to change their Boolean values***** int $Boolean=`checkBox -q -v EnableSmoke`; int $Boolean2=`checkBox -q -v EnableShader`; int $Boolean3=`checkBox -q -v EnSmokeShader`; int $Boolean4=`checkBox -q -v CBB`; //*****if the smoke exist when pressing this button, the smoke related controls will be disable***** if ($Boolean==1) { select -r smokeramp; checkBox -e -v 0 EnableSmoke; floatFieldGrp -e -en 0 SmokeUni; floatFieldGrp -e -en 0 SmokeVortex; doDelete; } //*****if the fire shader exist when pressing this button, the fire shader related controls will be disable***** if ($Boolean2==1) { checkBox -e -v 0 EnableShader; DeleteShader(); floatFieldGrp -e -en 0 AirD; floatFieldGrp -e -en 0 Gravity; floatFieldGrp -e -en 0 Turbul; floatFieldGrp -e -en 0 Density; floatFieldGrp -e -en 0 Temper; floatFieldGrp -e -en 0 intensity; floatFieldGrp -e -en 0 Colour; button -e -en 0 Change; button -e -en 0 CancelC; } //*****if the smoke shader exists when pressing this button, the smoke shader related controls will be disable***** if ($Boolean3==1) { checkBox -e -v 0 EnSmokeShader; DeleteSmokeShader(); floatFieldGrp -e -en 0 SmokeColor; floatFieldGrp -e -en 0 SmokeDensity; floatFieldGrp -e -en 0 SmokeTranspar; button -e -en 0 SmokeChange; button -e -en 0 SmokeCancelC; } //*****if the bone exists when pressing this button, the bone related controls will be disable***** if ($Boolean4==1) { checkBox -e -v 0 CBB; floatFieldGrp -e -en 0 Spin_Speed; floatFieldGrp -e -en 0 Spin_Vel; floatFieldGrp -e -en 0 Spin_Radius1; floatFieldGrp -e -en 0 Spin_Radius2; button -e -en 0 AnimateB; button -e -en 0 DeleteB; } //*****select the vortex circle and delete it***** select -r VortexCircle; doDelete; //*****select all the ramps and delete***** for ($i=1; $i<=2; $i++) { $Rampcircle[$i]="circleramp"+$i; select -add $Rampcircle[$i]; delete; } for ($j=3; $j<=$filenumber; $j++) { $Ramp[$j]="Particleramp"+$j; select -add $Ramp[$j]; delete; } //*****Create button will be available and the select vortex button will be disable once it is executed***** button -e -en 1 Vortexbutton; button -e -en 0 SelectVortex; } //*****the global procedure for selecting the fire whirl***** global proc SelectVortex() { //*****select the fire whirl***** select -r VortexCircle; } //*****the global procedure for animating the whirl animation (circulation)***** global proc AnimateVortex() { //*****set the total second(s) as user-defined***** float $animatetime=`floatFieldGrp -q -v1 time`; //*****set the animation delay, in the case that the smoke need more time to disappear, default is 0 ***** float $animationdelay=`floatFieldGrp -q -v1 animedelay`; //*****set the total frames by multiply by 24 frames***** float $totalframe=$animatetime*24; //*****set the delay frame(s) by multiply by 24 frames***** float $delayframe=$animationdelay*24; //*****the maximum playback frame is defined by adding the total frame and delay frame***** float $finaltotalframe=$totalframe+$delayframe; //*****set the vortex speed as user-defined***** float $VortexSpeed=`floatFieldGrp -q -v1 Vortex_Speed`; //*****obtain the keyframe gap (degree change per second) by dividing total frame and vortex speed***** float $KeyframeGap=$totalframe/$VortexSpeed; //*****total key frame equals to vortex speed actually, in order to avoid errors (in case the program can't find the user-defined value), it is set to be total frame divides key frame gap ***** float $totalKeyframe=$totalframe/$KeyframeGap; //*****define total play back frames***** playbackOptions -min 0 -max $finaltotalframe; //*****select the fire whirl***** select -r VortexCircle; //*****set up of whirl circulation animation***** for ($i=0; $i<$totalKeyframe; $i++) { //*****current time is defined by Key frame Gap x parameter (i)***** currentTime ($i*$KeyframeGap); //*****set the rotation Y of the fire whirl as 90 degrees x parameter (i)***** setAttr "VortexCircle.rotateY" ($i*90); //*****set the Key to the fire whirl model***** setKeyframe {"VortexCircle"}; } } //*****the global procedure for deleting the whirl animation Keys***** global proc DeleteKey() { //*****get the attributes from AnimateVortex function***** float $animatetime=`floatFieldGrp -q -v1 time`; float $totalframe=$animatetime*24; float $VortexSpeed=`floatFieldGrp -q -v1 Vortex_Speed`; float $KeyframeGap=$totalframe/$VortexSpeed; float $totalKeyframe=$totalframe/$KeyframeGap; //*****choose all the keyframes and delete them***** for ($i=0; $i<$totalKeyframe; $i++) { //*****go to the time where AnimateVortex() had set the keyframes***** currentTime ($i*$KeyframeGap); //*****select the fire whirl model and delete the keyframes***** select -r VortexCircle; timeSliderClearKey; } } //*****the global procedure for Fire Animation***** global proc FireAnimate() { //*****set the total second(s) as user-defined***** float $animatetime=`floatFieldGrp -q -v1 time`; //*****set the delay second(s) as user-defined***** float $animationdelay=`floatFieldGrp -q -v1 animedelay`; //*****set the total frames by multiply by 24 frames***** float $totalframe=$animatetime*24; //*****set the delay frames by multiply by 24 frames***** float $delayframe=$animationdelay*24; //*****the maximum playback frame is defined by adding total frames and delay frames***** float $finaltotalframe=$totalframe+$delayframe; //*****input for fire whirl animation***** //*****control for the fire animation start***** float $firestart=`floatFieldGrp -q -v1 STF`; //*****control for the fire starts to whirl up as fire whirl***** float $firewhirlup=`floatFieldGrp -q -v1 WUp`; //*****control for the fire whirl animation ends***** float $fireend=`floatFieldGrp -q -v1 End`; //*****change the controls values to frame count (multiply by 24)***** float $startin=$firestart*24; float $whirlUp=$firewhirlup*24; float $Endin=$fireend*24; //*****define a variable for enable smoke switch***** int $trueon=`checkBox-q -v EnableSmoke`; //*****particles and emitter name***** //*****Vortex Circle emitter and particles name***** string $CircleEmit="Circle_emit1"; string $Circlename="VortexCircle"; string $CirclepS="Circleparticle"+"Shape"; //*****goal particles emitter and particles name***** string $emitname[]; string $particle[]; string $pShapeName[]; //*****goal particles emitter attributes***** string $emitnameRate[]; string $emitnameSpeed[]; string $emitnameSpeedR[]; //*****Vortex Circle emitter attributes***** string $CircleEmitRate=$CircleEmit+".rate"; string $CircleEmitSpeed=$CircleEmit+".speed"; string $CircleEmitSpeedR=$CircleEmit+".speedRandom"; //*****the variable for the current time setting***** int $currenttime; //*****the user-defined vortex path number***** int $CurveNum= `intFieldGrp -q -v1 Path_num`; //*****set the total playback frame***** playbackOptions -min 0 -max $finaltotalframe; //*****set up the fire whirl animation in the certain nested for loops***** for ($i=0; $i<$CurveNum; $i++) { //*****define the emitters and particles names/ names with attributes***** $emitname[$i]="emit"+($i+1); $particle[$i]="curvep"+($i+1); $fireemit2[$i]="emit2"+($i+1); $pShapeName[$i]=$particle[$i]+"Shape"; //*****The attributes which will use in the animation rate, speed and speed random***** $emitnameRate[$i]=$emitname[$i]+".rate"; $emitnameSpeed[$i]=$emitname[$i]+".speed"; $emitnameSpeedR[$i]=$emitname[$i]+".speedRandom"; //*****set the beginning of the animation (0-6 frames)***** for ($j=0; $j<=1; $j++) { //*****current times is the paramenter (j) x 6***** $currenttime=$j*6; currentTime $currenttime; //******all the attributes are set to 0***** setAttr $CircleEmitRate 0; setAttr $CircleEmitSpeed 0; setAttr $CircleEmitSpeedR 0; setAttr $emitnameRate[$i] 0; setAttr $emitnameSpeed[$i] 0; setAttr $emitnameSpeedR[$i] 0; setKeyframe {$CircleEmit}; setKeyframe {$emitname[$i]}; } //*****whirl up animation set up (vortex circle)***** for ($k=1; $k<=$fireend-2; $k++) { //*****current time is the parament k times whirl up frames (whirl up user-defined value x 24)***** $currenttime=($startin)*$k; //*****set the whirl up frame limit, the key frames are added until the time slider reach this value: ($fireend-2)*24***** if ($currenttime>$Endin) { $currenttime=($fireend-2)*24; } currentTime $currenttime; //*****only the vortex circle particles emission update, it will gradually increase up to 200, speed is 4 and speed random is 1.***** setAttr $CircleEmitRate 200; setAttr $CircleEmitSpeed 4; setAttr $CircleEmitSpeedR 1; //setKeyframe {$emitname[$i]}; setKeyframe {$CircleEmit}; } //*****whirl up animation set up (fire path)***** for ($l=0; $l<=$fireend-2; $l++) { //*****set the update animation from frame 24 to frame (fireend-2)*24***** $currenttime=($l+($firewhirlup-1))*24; currentTime $currenttime; //*****the rate of the fire path emitters increase 150 times the parameter $l***** setAttr $emitnameRate[$i] ($l*150); //*****the speed of the fire path emitters increase 2 times the parameter $l***** setAttr $emitnameSpeed[$i] (2*$l); //*****the speed random of the fire path emitters increase by parameter $l***** setAttr $emitnameSpeedR[$i] (1*$l); //*****if the current time is greater that the end time (defined by user) x 24 +10, the rate, speed and speed random of all the particles will be 0.***** if ($currenttime>($Endin+10)) { setAttr $CircleEmitRate 0; setAttr $CircleEmitSpeed 0; setAttr $CircleEmitSpeedR 0; setAttr $emitnameRate[$i] 0; setAttr $emitnameSpeed[$i] 0; setAttr $emitnameSpeedR[$i] 0; } setKeyframe {$CircleEmit}; setKeyframe {$emitname[$i]}; } //*****animation set up for the second last second, it decrease the particles rate, speed and speed random at this point***** for ($m=0; $m<=1; $m++) { $currenttime=$Endin-24; currentTime $currenttime; setAttr $CircleEmitRate 50; setAttr $CircleEmitSpeed 1; setAttr $CircleEmitSpeedR 1; setAttr $emitnameRate[$i] 100; setAttr $emitnameSpeed[$i] 1; setAttr $emitnameSpeedR[$i] 1; setKeyframe {$CircleEmit}; setKeyframe {$emitname[$i]}; } //*****animation set up for the end seconds***** for ($p=0; $p<=5; $p++) { //*****the current time is the end time x24 + parameter p***** $currenttime=$Endin+$p; currentTime $currenttime; //*****define the decrease in the particles rate***** int $endrate=(50-(50*($p+1))/5); //*****force the rate not to increase in keyframing***** if ($endrate<0) { $endrate=0; } //*****all the rate, speed and speed random are set to 0***** setAttr $CircleEmitRate 0; setAttr $CircleEmitSpeed 0; setAttr $CircleEmitSpeedR 0; setAttr $emitnameRate[$i] $endrate; setAttr $emitnameSpeed[$i] 0; setAttr $emitnameSpeedR[$i] 0; setKeyframe {$CircleEmit}; //setKeyframe {$fireemit2[$i]}; setKeyframe {$emitname[$i]}; } } //*****if the smoke is enable, animate the smoke as well***** if ($trueon==1) {SmokeAnime();} } //*****the Local procedure for animating the smoke***** proc SmokeAnime() { //*****the variables are similar to FireAnimate()***** float $animatetime=`floatFieldGrp -q -v1 time`; float $totalframe=$animatetime*24; float $animationdelay=`floatFieldGrp -q -v1 animedelay`; float $delayframe=$animationdelay*24; float $finaltotalframe=$totalframe+$delayframe; //input for fire whirl animation float $firestart=`floatFieldGrp -q -v1 STF`; float $firewhirlup=`floatFieldGrp -q -v1 WUp`; float $fireend=`floatFieldGrp -q -v1 End`; float $startin=$firestart*24; float $whirlUp=$firewhirlup*24; float $Endin=$fireend*24; //*****a variable for setting the power value in the smoke animation***** float $Smokepow; //*****the variable for setting the current time***** int $currenttime; //*****string variable for smoke emitter name***** string $smokeemit="SmokeEmit"; //*****the first 6 frames of smoke animation, its rate is 0***** for ($i=0; $i<=1; $i++) { $currenttime=$i*6; currentTime $currenttime; setAttr "SmokeEmit.rate" 0; setKeyframe {$smokeemit}; } //*****after reaching the frame in whirl up seconds x 24, smoke is increased by (j+1) to the power of 5 times 4***** for ($j=0; $j<=$fireend-2; $j++) { //*****Smoke power is defined as (j+1) to the power of 5***** $Smokepow = `pow (5) ($j+1)`; $currenttime=$startin*$j; currentTime $currenttime; setAttr "SmokeEmit.rate" (4*$Smokepow); setKeyframe {$smokeemit}; } //*****the animation in the 2nd last second of the whole animation, its rate is 100***** $currenttime=$Endin-24; currentTime $currenttime; setAttr "SmokeEmit.rate" 100; setKeyframe {$smokeemit}; //*****the animation in the last second of the whole animation, its rate is 0***** $currenttime=$Endin; currentTime $currenttime; setAttr "SmokeEmit.rate" 0; setKeyframe {$smokeemit}; } //*****the Local procedure for deleting the smoke animation***** proc DeleteSmokeAnime() { //*****retrieve the variables from SmokeAnime()***** float $animatetime=`floatFieldGrp -q -v1 time`; float $totalframe=$animatetime*24; float $animationdelay=`floatFieldGrp -q -v1 animedelay`; float $delayframe=$animationdelay*24; float $finaltotalframe=$totalframe+$delayframe; //*****input for fire whirl animation***** float $firestart=`floatFieldGrp -q -v1 STF`; float $firewhirlup=`floatFieldGrp -q -v1 WUp`; float $fireend=`floatFieldGrp -q -v1 End`; float $startin=$firestart*24; float $whirlUp=$firewhirlup*24; float $Endin=$fireend*24; //*****variable for current time***** int $currenttime; //*****string variable for the smoke emitter name***** string $smokeemit="SmokeEmit"; //*****select all the Keyframes in all animation stage and delete***** for ($i=0; $i<=1; $i++) { $currenttime=$i*6; currentTime $currenttime; select -r $smokeemit; timeSliderClearKey; } for ($j=0; $j<=$fireend-2; $j++) { $currenttime=$startin*$j; currentTime $currenttime; select -r $smokeemit; timeSliderClearKey; } $currenttime=$Endin-24; currentTime $currenttime; select -r $smokeemit; timeSliderClearKey; $currenttime=$Endin; currentTime $currenttime; select -r $smokeemit; timeSliderClearKey; //*****at the same time, set the smoke emitter back to 200, the setting is the same as before animating***** setAttr "SmokeEmit.rate" 200; } //*****the Global procedure for deleting the fire animation***** global proc DeleteFireAnime() { //*****retrieve the variables from FireAnimate()***** float $animatetime=`floatFieldGrp -q -v1 time`; float $totalframe=$animatetime*24; //*****input for fire whirl animation***** float $firestart=`floatFieldGrp -q -v1 STF`; float $firewhirlup=`floatFieldGrp -q -v1 WUp`; float $fireend=`floatFieldGrp -q -v1 End`; float $startin=$firestart*24; float $whirlUp=$firewhirlup*24; float $Endin=$fireend*24; //*****the Boolean value for enable smoke***** int $trueon=`checkBox-q -v EnableSmoke`; //*****string array for the fire emitter name with rate***** string $emitnameRate[]; //*****particles and emitter name***** //*****Vortex Circle emitter and particles name***** string $CircleEmit="Circle_emit1"; string $Circlename="VortexCircle"; string $CirclepS="Circleparticle"+"Shape"; //*****goal particles emitter and particles name***** string $emitname[]; string $particle[]; string $pShapeName[]; //*****the variable for the current time***** int $currenttime; //*****the variable for the vortex path number***** int $CurveNum= `intFieldGrp -q -v1 Path_num`; //*****select all the Keyframe in all the animation stages and delete***** for ($i=0; $i<$CurveNum; $i++) { $emitname[$i]="emit"+($i+1); $particle[$i]="curvep"+($i+1); $pShapeName[$i]=$particle[$i]+"Shape"; for ($j=0; $j<=1; $j++) { $currenttime=$j*6; currentTime $currenttime; select -add $emitname[$i] $CircleEmit; timeSliderClearKey; } for ($k=1; $k<=3; $k++) { $currenttime=($startin)*$k; currentTime $currenttime; select -add $emitname[$i] $CircleEmit; timeSliderClearKey; } for ($l=1; $l<$fireend; $l++) { $currenttime=($l+($firewhirlup-1))*24; currentTime $currenttime; select -add $emitname[$i] $CircleEmit; timeSliderClearKey; } for ($m=0; $m<=1; $m++) { $currenttime=($firewhirlup*4+$m)*24; currentTime $currenttime; select -add $emitname[$i] $CircleEmit; timeSliderClearKey; } for ($n=0; $n<=5; $n++) { $currenttime=$Endin+$n; currentTime $currenttime; select -add $emitname[$i] $CircleEmit; timeSliderClearKey; } //*****at the same time, set the fire rate back to the original setting***** $emitnameRate[$i]=$emitname[$i]+".rate"; setAttr "Circle_emit1.rate" 100; setAttr $emitnameRate[$i] 200; } //*****if the smoke exists delete the smoke animation as well***** if ($trueon==1) {DeleteSmokeAnime();} } //*****the Global procedure for whirl bone animation***** global proc Animatebone() { //*****spin speed is the user-defined value for angle division***** float $SpinSpeed=`floatFieldGrp -q -v1 Spin_Speed`; //*****spin velocity is the user-defined value for determining the animation speed (the difference between keyframes)***** float $SpinVel=`floatFieldGrp -q -v1 Spin_Vel`; //*****spin radius 1 is the user-defined value for even bone, i.e. FJ2, FJ4..***** float $SpinRadius1=`floatFieldGrp -q -v1 Spin_Radius1`; //*****spin radius 2 is the user-defined value for odd bone, i.e. FJ3, FJ5..***** float $SpinRadius2=`floatFieldGrp -q -v1 Spin_Radius2`; //*****User-defined value of total second***** float $animatetime=`floatFieldGrp -q -v1 time`; //*****set the delay second(s) as user-defined***** float $animationdelay=`floatFieldGrp -q -v1 animedelay`; //*****User-defined value of vortex path height***** float $VortexHeight=`floatFieldGrp -q -v1 Vortex_height`; //*****the total frame is the total second times 24***** float $totalframe=$animatetime*24; //*****set the delay frames by multiply by 24 frames***** float $delayframe=$animationdelay*24; //*****the maximum playback frame is defined by adding total frames and delay frames***** float $finaltotalframe=$totalframe+$delayframe; //*****Angle division in the spinning process, it is defined by totalframe/Spin Speed/Vel***** float $angulardiv=$totalframe/$SpinSpeed/$SpinVel; //*****the keyframe gap is the division of totalframe and spin velocity***** float $SpinGap=$totalframe/$SpinVel; //*****the total keyframes is the multiplication of spin speed and spin turn***** int $totalGap=$SpinVel; //*****the x and z coordinates of the bone spin***** float $Spinx,$Spinz; //*****the spin angle, to determine the rotation speed**** float $Spinangle; //*****string array for the even bone name***** string $Jname[]; //*****string array for the even bone names with the translate X***** string $JnameMoveX[]; //*****string array for the even bone names with the translate Z***** string $JnameMoveZ[]; //*****string array for the odd bone names***** string $Jname1[]; //*****string array for the odd bone names with the translate X***** string $JnameMoveX1[]; //*****string array for the odd bone names with the translate Z***** string $JnameMoveZ1[]; //*****set the total playback frame***** playbackOptions -min 0 -max $finaltotalframe; //*****animation for the even bones***** for ($i=0; $i<$VortexHeight; $i++) { $Jname[$i]="FJ"+(($i+1)*2); for ($j=0; $j<=$totalGap; $j++) { $JnameMoveX[$j]=$Jname[$i]+".tx"; $JnameMoveZ[$j]=$Jname[$i]+".tz"; currentTime ($j*$SpinGap); //*****the spin angle is defined by 360 (=2*pi)/angle division x j***** $Spinangle=2*3.14/$angulardiv*$j; //*****the position of x and z are the points in the circle, i.e. x=Rcos(spinangle), z=Rsin(spinangle)***** $Spinx=$SpinRadius1*cos($Spinangle); $Spinz=$SpinRadius1*sin($Spinangle); setAttr $JnameMoveX[$i] $Spinx; setAttr $JnameMoveZ[$i] $Spinz; setKeyframe {$Jname[$i]}; } } //*****animation for the odd bones, algorithm is almost the same as even bones animation***** for ($k=0; $k<$VortexHeight-1; $k++) { $Jname1[$k]="FJ"+((($k+1)*2)+1); for ($l=0; $l<=$totalGap; $l++) { $JnameMoveX1[$l]=$Jname1[$k]+".tx"; $JnameMoveZ1[$l]=$Jname1[$k]+".tz"; currentTime ($l*$SpinGap); $Spinangle=2*3.14/$angulardiv*$l; $Spinx=-$SpinRadius2*cos($Spinangle); $Spinz=-$SpinRadius2*sin($Spinangle); setAttr $JnameMoveX1[$l] $Spinx; setAttr $JnameMoveZ1[$l] $Spinz; setKeyframe {$Jname1[$k]}; } } } //*****the Global procedure for deleting the bone animation***** global proc DeleteAllBoneAnime() { //*****retrieve the variables from Animatebone()***** float $SpinSpeed=`floatFieldGrp -q -v1 Spin_Speed`; float $SpinVel=`floatFieldGrp -q -v1 Spin_Vel`; float $animatetime=`floatFieldGrp -q -v1 time`; float $VortexHeight=`floatFieldGrp -q -v1 Vortex_height`; float $totalframe=$animatetime*24; float $SpinGap=$totalframe/$SpinVel; int $totalGap=$SpinVel; string $Jname[]; string $JnameMoveX[]; string $JnameMoveZ[]; string $Jname1[]; string $JnameMoveX1[]; string $JnameMoveZ1[]; //*****select the bones according to Animatebone() algorithm, delete and set the x and z coordinates to 0***** for ($i=0; $i<$VortexHeight; $i++) { $Jname[$i]="FJ"+(($i+1)*2); for ($j=0; $j<=$totalGap; $j++) { $JnameMoveX[$j]=$Jname[$i]+".tx"; $JnameMoveZ[$j]=$Jname[$i]+".tz"; currentTime ($j*$SpinGap); select -add $Jname[$i]; timeSliderClearKey; setAttr $JnameMoveX[$j] 0; setAttr $JnameMoveZ[$j] 0; } } for ($k=0; $k<$VortexHeight-1; $k++) { $Jname1[$k]="FJ"+((($k+1)*2)+1); for ($l=0; $l<=$totalGap; $l++) { $JnameMoveX1[$l]=$Jname1[$k]+".tx"; $JnameMoveZ1[$l]=$Jname1[$k]+".tz"; currentTime ($l*$SpinGap); select -add $Jname1[$k]; timeSliderClearKey; setAttr $JnameMoveX1[$l] 0; setAttr $JnameMoveZ1[$l] 0; } } } //*****the Global procedure for enable set free keyframes in the bone animation***** global proc enableSetFreeKey(int $state4) { //*****create a switch variable to control the action on enable set free key check box***** $state4=`checkBox -q -v EnableSFK`; //*****switch function for the on/off action on the enable set free key check box****** switch ($state4) { //*****if state4 is 0, all the set free key related button and fields are disable***** case 0: button -e -enable 0 SetKey; button -e -enable 0 DeleteKey; intFieldGrp -e -en 0 BoneID; button -e -en 0 SelectBone; floatFieldGrp -e -en 0 CurrTime; floatFieldGrp -e -en 0 Bonepos; break; //*****if state4 is 1, all the set free key related button and fields are enable***** case 1: button -e -enable 1 SetKey; button -e -enable 1 DeleteKey; intFieldGrp -e -en 1 BoneID; button -e -en 1 SelectBone; floatFieldGrp -e -en 1 CurrTime; floatFieldGrp -e -en 1 Bonepos; break; //*****no default setting***** default: break; } } //*****the Global procedure for enable set free transform keyframes for fire whirl animation***** global proc enableFreeTransformKey(int $state0) { //*****create a switch variable to control the action on set free transform key check box***** $state0=`checkBox -q -v EnableFTK`; switch ($state0) { //*****if state0 is 0, all the set free transform key related button and fields are disable***** case 0: button -e -enable 0 SetTKey; button -e -enable 0 DeleteTKey; floatFieldGrp -e -en 0 CurrTimeT; break; //*****if state0 is 1, all the set free transform key related button and fields are enable***** case 1: button -e -enable 1 SetTKey; button -e -enable 1 DeleteTKey; floatFieldGrp -e -en 1 CurrTimeT; break; //*****no default setting***** default: break; } } //*****the Global procedure for setting free transform keyframes to fire whirl***** global proc SetTransformKey(int $type3) { //*****set the array for fire position xyz***** float $firepos[]; $firepos[0]=`floatFieldGrp -q -v1 FirePos`; $firepos[1]=`floatFieldGrp -q -v2 FirePos`; $firepos[2]=`floatFieldGrp -q -v3 FirePos`; //*****set the array for fire rotation xyz***** float $firerot[]; $firerot[0]=`floatFieldGrp -q -v1 FireRot`; $firerot[1]=`floatFieldGrp -q -v2 FireRot`; $firerot[2]=`floatFieldGrp -q -v3 FireRot`; //*****set the array for fire scale xyz***** float $firescale[]; $firescale[0]=`floatFieldGrp -q -v1 FireScale`; $firescale[1]=`floatFieldGrp -q -v2 FireScale`; $firescale[2]=`floatFieldGrp -q -v3 FireScale`; //*****set the user-defined current time***** float $TcurrTime=`floatFieldGrp -q -v1 CurrTimeT`; //***** switch function for the transform attribute control***** switch ($type3) { //*****if type 3 is 1, the transform attributes and the current time for keyframing are defined by user***** case 1: currentTime $TcurrTime; select -r VortexCircle; setAttr "VortexCircle.tx" $firepos[0]; setAttr "VortexCircle.ty" $firepos[1]; setAttr "VortexCircle.tz" $firepos[2]; setAttr "VortexCircle.rx" $firerot[0]; setAttr "VortexCircle.ry" $firerot[1]; setAttr "VortexCircle.rz" $firerot[2]; setAttr "VortexCircle.sx" $firescale[0]; setAttr "VortexCircle.sy" $firescale[1]; setAttr "VortexCircle.sz" $firescale[2]; setKeyframe {"VortexCircle"}; break; //*****if type 3 is 2, the keyframe will be deleted according the time //*****user input, e.g. delete the keyframe at frame 40, the user will //*****have to input 40 in the current time field and press the provided button for deleting the keyframe***** case 2: currentTime $TcurrTime; select -r VortexCircle; timeSliderClearKey; break; //*****no setting for default***** default: break; } } //*****the Global procedure for Changing Fire Flow and Smoke properties ***** global proc ChangeFWValue(int $value) { //*****Smoke Uniform Force (user-defined value)***** float $UniformF=`floatFieldGrp -q -v1 SmokeUni`; //*****Smoke Vortex Force (user-defined value)***** float $VortexF=`floatFieldGrp -q -v1 SmokeVortex`; //*****Fire Flow Speed (user-defined value)***** float $FireFlowSp=`floatFieldGrp -q -v1 FS`; //*****Fire Flow Speed Offset (user-defined value)***** float $FlowSpOffset=`floatFieldGrp -q -v1 FFSO`; //*****Vortex Path Number (user-defined value)***** int $CurveNum= `intFieldGrp -q -v1 Path_num`; //*****the Boolean value for smoke enable***** int $trueon=`checkBox-q -v EnableSmoke`; //*****string array for the particles name***** string $particle[]; //*****string array for the particles name + Shape***** string $pShapeName[]; //*****string array for the particles name + Shape +.FlowSpeed***** string $pShapeFlowspeed[]; //*****string array for the particles name + Shape +.FlowSpeedOffset***** string $pShapeFSO[]; //*****switch function for changing the fire flow and smoke properties***** switch ($value) { //*****if value is 0, the values for the fire flow are set to default***** case 0: for ($i=0; $i<$CurveNum; $i++) { $particle[$i]="curvep"+($i+1); $pShapeName[$i]=$particle[$i]+"Shape"; $pShapeFlowspeed[$i]=$pShapeName[$i]+".FS"; $pShapeFSO[$i]=$pShapeName[$i]+".FSO"; setAttr $pShapeFlowspeed[$i] 12; setAttr $pShapeFSO[$i] 0; } //*****if smoke is enable, smoke properties are set to default as well***** if ($trueon==1) { setAttr "SmokeUni.magnitude" 5; setAttr "Smokevortex.magnitude" 4; } print "Result: Cancel Change. All Values are set to default."; break; //*****if value is 1, the values for the fire flow are set by user***** case 1: for ($j=0; $j<$CurveNum; $j++) { $particle[$j]="curvep"+($j+1); $pShapeName[$j]=$particle[$j]+"Shape"; $pShapeFlowspeed[$j]=$pShapeName[$j]+".FS"; $pShapeFSO[$j]=$pShapeName[$j]+".FSO"; setAttr $pShapeFlowspeed[$j] $FireFlowSp; setAttr $pShapeFSO[$j] $FlowSpOffset; } print "Result: Fire Flow Change."; //*****if smoke is enable, smoke properties are also set by user***** if ($trueon==1) { setAttr "SmokeUni.magnitude" $UniformF; setAttr "Smokevortex.magnitude" $VortexF; print "Result: Fire Flow and Smoke Force Change."; } break; //*****no default setting***** default: break; } } //*****the Global procedure for enabling free fire whirl set key ***** global proc EnFireAnimeFree(int $switch) { //*****create a variable for controlling enable fire set free key check box***** $switch=` checkBox -q -v EnableFireSFK `; //*****switch function for controlling enable fire set free key***** switch ($switch) { //*****if switch is 0, all the fire set key related buttons and fields are unavailable***** case 0: floatFieldGrp -e -en 0 VCrate; floatFieldGrp -e -en 0 FCurverate; floatFieldGrp -e -en 0 Smokerate; floatFieldGrp -e -en 0 FireCurrTime; button -e -en 0 FireSetKey; button -e -en 0 FireDeleteKey; break; //*****if switch is 1, all the fire set key related buttons and fields are available***** case 1: floatFieldGrp -e -en 1 VCrate; floatFieldGrp -e -en 1 FCurverate; floatFieldGrp -e -en 1 Smokerate; floatFieldGrp -e -en 1 FireCurrTime; button -e -en 1 FireSetKey; button -e -en 1 FireDeleteKey; break; //*****no default setting***** default: break; } } //*****the Global procedure for setting fire whirl free set key ***** global proc SetFireFreeKey(int $value1) { //*****user-defined current time value***** float $currtime=`floatFieldGrp -q -v1 FireCurrTime`; //*****user-defined smoke particles rate***** float $Smokerate=` floatFieldGrp -q -v1 Smokerate`; //*****user-defined vortex circle particles rate***** float $VCrate=`floatFieldGrp -q -v1 VCrate`; //*****user-defined fire path particles rate***** float $FCurverate=`floatFieldGrp -q -v1 FCurverate`; //*****string array for the fire path emitter names***** string $emitname[]; //*****string array for the fire path emitter names +Shape + .rate***** string $emitnameRate[]; //*****user-defined fire path number***** int $CurveNum= `intFieldGrp -q -v1 Path_num`; //*****switch function for setting fire whirl free set key ***** switch ($value1) { //*****if value1 is 1, the values for the emitter and current time can be defined by user, the user can set key***** case 1: for ($i=0; $i<$CurveNum; $i++) { $emitname[$i]="emit"+($i+1); $emitnameRate[$i]= $emitname[$i]+".rate"; currentTime $currtime; setAttr "Circle_emit1.rate" $VCrate; setAttr $emitnameRate[$i] $FCurverate; setAttr "SmokeEmit.rate" $Smokerate; setKeyframe {"Circle_emit1"}; setKeyframe {"Circle_emit1"}; setKeyframe {$emitname[$i]}; } break; //*****if value1 is 2, the values for the emitter and current time are return to default, but the current time is still user-defined, for deleting keyframes***** case 2: for ($j=0; $j<$CurveNum; $j++) { $emitname[$j]="emit"+($j+1); $emitnameRate[$j]= $emitname[$j]+".rate"; currentTime $currtime; select -add SmokeEmit Circle_emit1 $emitnameRate[$j]; timeSliderClearKey; } break; //*****no default setting***** default: break; } } //*****the Global procedure for selecting the bone ***** global proc SelectBone() { //*****Bone ID, for user to select individual bones ***** int $BoneID=`intFieldGrp -q -v1 BoneID`; //*****string array for bone name***** string $Jname="FJ"+$BoneID; //*****select the bone according to the ID input***** select -r $Jname; } //*****the Global procedure for free bones animation set key ***** global proc KeyCurrTime(int $type0) { //*****user-defined current time field***** float $currtime=`floatFieldGrp -q -v1 CurrTime`; //*****float array for user-defined bone position***** float $bonepos[]; $bonepos[0] =`floatFieldGrp -q -v1 Bonepos`; $bonepos[1] =`floatFieldGrp -q -v2 Bonepos`; $bonepos[2] =`floatFieldGrp -q -v3 Bonepos`; //*****Bone ID, for user to select individual bones ***** int $BoneID=`intFieldGrp -q -v1 BoneID`; //*****string array for bone name***** string $Jname="FJ"+$BoneID; //*****string array for bone name with transform attributes***** string $Jnametx=$Jname+".tx"; string $Jnamety=$Jname+".ty"; string $Jnametz=$Jname+".tz"; //*****switch function for keying free bone animation***** switch ($type0) { //*****if type0 is 1, the bone positions and the current time can be defined by user, and the user is able to set key***** case 1: currentTime $currtime; select -r $Jname; setAttr $Jnametx $bonepos[0]; setAttr $Jnamety $bonepos[1]; setAttr $Jnametz $bonepos[2]; setKeyframe {$Jname}; break; //*****if type0 is 2, the bone positions are set to original position , and the user is able to delete key with user-defined current time field***** case 2: currentTime $currtime; select -r $Jname; timeSliderClearKey; setAttr $Jnametx 0; setAttr $Jnamety ($BoneID+0.2); setAttr $Jnametz 0; break; //*****no default setting***** default: break; } } //*****the Local procedure for fire shader creation ***** proc fireshader() { //*****user-defined fire path number***** int $CurveNum= `intFieldGrp -q -v1 Path_num`; //*****user-defined vortex height***** float $VortexHeight=`floatFieldGrp -q -v1 Vortex_height`; //*****string name for vortex circle particles****** string $Circleparticle="Circleparticle"; //*****particles name string array***** string $particle[]; //*****create particle cloud shader as the main Fire Shader***** shadingNode -asShader particleCloud -name FireShader; //*****create the shading engine ***** sets -renderable true -noSurfaceShader true -empty -name FireShaderSG; //*****connect the FireShader outColor to the FireShader SG volume Shader***** connectAttr -f FireShader.outColor FireShaderSG.volumeShader; //*****select the fire path particles and vortex circle particles***** for ($i=0; $i<$CurveNum; $i++) { $particle[$i]="curvep"+($i+1); select -add $particle[$i] $Circleparticle; } //*****link the selection to the FireShader and FireShaderSG***** sets -e -forceElement FireShaderSG; //*****set the particle cloud (FireShader) attributes**** setAttr "FireShader.color" -type double3 0.93 0.533 0.1; //*****colour 0.93 0.533 0.1 (orange)***** setAttr "FireShader.incandescence" -type double3 0.7 0.7 0.7; //*****incandescence 0.7 0.7 0.7 (light grey)***** setAttr "FireShader.glowIntensity" 0.05; //*****glow intensity 0.5***** setAttr "FireShader.density" 0.1; //*****density 0.1***** setAttr "FireShader.translucence" 0.8; //*****transluscence 0.8***** setAttr "FireShader.noiseFreq" 0.2; //*****noise frequency 0.2***** //*****create the crater texture and link its outColor to FireShader blobMap****** shadingNode -asTexture crater -n FireCrater; connectAttr -force FireCrater.outColor FireShader.blobMap; //***** set the crater (FireShader) attributes****** setAttr "FireCrater.shaker" 1; //*****shaker 1***** setAttr "FireCrater.channel1" -type double3 0.7 0.7 0.7; //*****channel 1 0.7 0.7 0.7 (light grey)***** setAttr "FireCrater.channel2" -type double3 0 0 0; //*****channel 2 0 0 0 (black)***** setAttr "FireCrater.channel3" -type double3 0 0 0; //*****channel 3 0 0 0 (black)***** setAttr "FireCrater.melt" 0.2; //*****melt 0.2***** setAttr "FireCrater.balance" 0.2; //*****balance 0.2***** setAttr "FireCrater.frequency" 2; //*****frequency 2 ***** //*****create Utility Node, particle Sampler Info and link its outtransparency to FireShader transparency***** shadingNode -asUtility particleSamplerInfo -n FireparticleSamplerInfo; connectAttr FireparticleSamplerInfo.outTransparency FireShader.transparency; //*****create solid Fractal and link its out Alpha to FireShader noise***** shadingNode -asTexture solidFractal -n FireFractal; connectAttr -force FireFractal.outAlpha FireShader.noise; //***** set the solid fractal (FireShader) attributes****** setAttr "FireFractal.animated" 1; //*****animated on ***** setAttr "FireFractal.time" 0.22; //*****time 0.22***** setAttr "FireFractal.timeRatio" 3.4; //*****time ratio 3.4***** setAttr "FireFractal.threshold" 0.05; //*****threshold 0.05***** setAttr "FireFractal.amplitude" 0.9; //*****amplitude 0.9 ***** setAttr "FireFractal.ratio" 0.707; //*****ratio 0.707***** setAttr "FireFractal.frequencyRatio" 2.5; //*****frequency Ratio 2.5***** setAttr "FireFractal.bias" 1; //*****bias 1 ***** setAttr "FireFractal.defaultColor" -type double3 0.62 0.62 0.62; //*****default colour 0.62 0.62 0.62 (grey)***** setAttr "FireFractal.colorOffset" -type double3 0.16 0.16 0.16; //*****colour offset 0.16 0.16 0.16***** //*****add Fluid 3D Texture to the shader and connect its out Color to Fire Shader color***** shadingNode -asTexture fluidTexture3D -n FireFluid; connectAttr -force FireFluid.outColor FireShader.color; //*****rename Fluid name***** rename |fluidTexture3D1 "FireFluid3D"; //*****add Time Utility to the Fluid Texture and link it to Fluid current time***** shadingNode -asUtility time -name Firetime; connectAttr Firetime.outTime FireFluid.currentTime; //*****link the particle sampler info out color to Fluid Texture transparency***** connectAttr -force FireparticleSamplerInfo.outTransparency FireFluid.transparency; //*****Mental Ray Shader addition***** //*****add Black Body Shader to mi-Light Map Shader in FireShaderSG(Shading Engine) ***** shadingNode -asUtility mib_blackbody -n FireBlackbody; connectAttr -f FireBlackbody.outValue FireShaderSG.miLightMapShader; //*****add Particle Volume Photon Shader to mi-Light Map Shader in FireShaderSG(Shading Engine) ***** shadingNode -asUtility parti_volume_photon -n Fireparti; connectAttr -f Fireparti.outValue FireShaderSG.miPhotonVolumeShader; //*****add Dielectric Material Photon Shader to mi- Photon Volume Shader in FireShaderSG(Shading Engine) ***** shadingNode -asUtility dielectric_material_photon -n FirePhoton; connectAttr -f FirePhoton.outValue FireShaderSG.miPhotonShader; //*****add Dielectric Material Shader to mi- Material Shader in FireShaderSG(Shading Engine) ***** shadingNode -asShader dielectric_material -n FirePhotonM; connectAttr -f FirePhotonM.outValue FireShaderSG.miMaterialShader; //*****create Dielectric Photon shader (Shading Engine) and link it to both miMaterialShader & miPhotonShader***** sets -renderable true -noSurfaceShader true -empty -name FirePhotonMSG; connectAttr FirePhotonM.outValue FirePhotonMSG.miMaterialShader; connectAttr FirePhotonM.outValue FirePhotonMSG.miPhotonShader; //*****add Luminance Node and link its out Alpha to FireFluid ***** shadingNode -asUtility luminance -n Firelum; connectAttr FireFluid.outAlpha Firelum.valueR; connectAttr FireFluid.outAlpha Firelum.valueG; connectAttr FireFluid.outAlpha Firelum.valueB; //*****add bump map and link it to Fire Shader and Luminance Node **** shadingNode -asUtility bump2d -n FireBump; connectAttr Firelum.outValue FireBump.bumpValue; connectAttr FireBump.outNormal FireShader.normalCamera; //*****add Set Range Node and link to Particle Volume Photon Shader (Height)**** shadingNode -asUtility setRange -n FireSetRange; connectAttr -f FireSetRange.nodeState Fireparti.height; //*****create solid Fractal and link its out Alpha to Set Range Node***** shadingNode -asTexture solidFractal -n FireMRFractal; connectAttr -force FireMRFractal.outAlpha FireSetRange.value.valueX; connectAttr -force FireMRFractal.outAlpha FireSetRange.value.valueY; connectAttr -force FireMRFractal.outAlpha FireSetRange.value.valueZ; //*****add Remap Value Node and link its out Color to Particle Volume Photon Shader (scatter)**** shadingNode -asUtility remapValue -n Fireremap; connectAttr -f Fireremap.outColor Fireparti.scatter; //*****create volume noise and link its out alpha to Remap Value Node***** shadingNode -asTexture volumeNoise -n FireMRVnoise; connectAttr -force FireMRVnoise.outAlpha Fireremap.inputValue; //*****setting Fire Fluid attributes***** setAttr "FireFluid.resolution" 20 20 20; //*****resolution 20 20 20***** setAttr "FireFluid.dimensionsW" (4+4* $VortexHeight); //*****dimension Width 4+4x Vortex Height***** setAttr "FireFluid.dimensionsH" (4+4* $VortexHeight); //*****dimension Height 4+4x Vortex Height***** setAttr "FireFluid.dimensionsD" (4+4* $VortexHeight); //*****dimension Depth 4+4x Vortex Height***** setAttr "FireFluid.boundaryX" 0; //*****Boundary X none***** setAttr "FireFluid.boundaryY" 2; //*****Boundary Y -Y***** setAttr "FireFluid.boundaryZ" 0; //*****Boundary Z none***** setAttr "FireFluid.temperatureMethod" 2; //*****Temperature method Dynamic Method***** setAttr "FireFluid.fuelMethod" 2; //*****Fuel method Dynamic Method***** setAttr "FireFluid.viscosity" 0.5; //*****Viscosity 0.5***** setAttr "FireFluid.friction" 0.1; //*****Friction 0.1***** setAttr "FireFluid.velocityDamp" 0.1; //*****Velocity Damp 0.1***** setAttr "FireFluid.densityScale" 2; //*****Density Scale 2***** setAttr "FireFluid.densityBuoyancy" 8; //*****Density Buoyancy 8***** setAttr "FireFluid.densityDissipation" 0.5; //*****Density Dissipation 0.5***** setAttr "FireFluid.densityDiffusion" 0.1; //*****Density Diffusion 0.1***** setAttr "FireFluid.velocitySwirl" 15; //*****Velocity Swirl 15***** setAttr "FireFluid.turbulenceStrength" 0.2; //*****Turbulence Strength 0.2***** setAttr "FireFluid.temperatureScale" 2; //*****Temperature Scale 2***** setAttr "FireFluid.buoyancy" 5; //*****Temperature Buoyancy 5***** setAttr "FireFluid.temperatureTurbulence" 0.3; //*****Temperature Turbulence 0.3 ***** setAttr "FireFluid.reactionSpeed" 0.05; //*****Reaction Speed 0.05***** setAttr "FireFluid.fuelScale" 1; //*****Fuel Scale 1 ***** setAttr "FireFluid.lightColor" -type double3 1 1 1 ; //*****Light Colour 1 1 1 (white)***** setAttr "FireFluid.dropoffShape" 1; //*****Drop Off Shape 1***** setAttr "FireFluid.edgeDropoff" 0.5; //*****Edge Drop off 0.5***** setAttr "FireFluid.colorInput" 8; //*****Colour Input Pressure***** setAttr "FireFluid.color[0].color_Position" 1; //***** [0] Colour Position 1***** setAttr "FireFluid.color[0].color_Color" -type double3 0 0 0 ; //***** Position 1 Colour 0 0 0 (black)***** setAttr "FireFluid.incandescenceInput" 6; //*****Incandescence Input Temperature***** setAttr "FireFluid.incandescence[0].incandescence_Position" 1; //***** [0] Incandescence Position 1***** setAttr "FireFluid.incandescence[1].incandescence_Position" 0; //***** [1] Incandescence Position 0***** setAttr "FireFluid.incandescence[0].incandescence_Interp" 1; //***** [0] Incandescence Interpolation Linear***** setAttr "FireFluid.incandescence[1].incandescence_Interp" 1; //***** [1] Incandescence Interpolation Linear***** setAttr "FireFluid.incandescence[0].incandescence_Color" -type double3 0 0 0; //***** [0] Incandescence Colour 0 0 0 (black)***** setAttr "FireFluid.incandescence[1].incandescence_Color" -type double3 1 0.421 0.2; //***** [1] Incandescence Colour 1 0.421 0.2 (orange)***** setAttr "FireFluid.opacityInput" 5; //*****Opacity Input Density***** setAttr "FireFluid.opacity[0].opacity_Position" 0; //*****[0] Opacity Position 0***** setAttr "FireFluid.opacity[1].opacity_Position" 0.22; //*****[1] Opacity Position 0.22***** setAttr "FireFluid.opacity[2].opacity_Position" 1; //*****[2] Opacity Position 1***** setAttr "FireFluid.opacity[0].opacity_FloatValue" 0; //*****[0] Opacity Float Value 0***** setAttr "FireFluid.opacity[1].opacity_FloatValue" 1; //*****[1] Opacity Float Value 1***** setAttr "FireFluid.opacity[2].opacity_FloatValue" 0; //*****[2] Opacity Float Value 0***** setAttr "FireFluid.opacityInputBias" 0.351; //***** Opacity Input Bias 0.351***** setAttr "FireFluid.renderInterpolator" 3; //***** Render Interpolator 3***** setAttr "FireFluid3D.translateY" ($VortexHeight*2); //*****Translate Y (Vortex Height x 2)***** //*****parent the Fluid container to Vortex Circle***** select -r FireFluid3D VortexCircle; parent; select -cl; //*****Bump attributes***** setAttr "FireBump.bumpFilter" 0.38; //*****Bump Filter 0.38***** setAttr "FireBump.bumpDepth" -3; //*****Bump Depth -3***** //*****setting Mental Ray Shaders attributes***** //*****Black Body***** setAttr "FireBlackbody.temperature" 4600; //*****Temperature 4600K***** setAttr "FireBlackbody.intensity" 1; //*****Intensity 1***** //*****Particle Volume Photon Shader***** setAttr "Fireparti.mode" 1; //*****Mode 1***** setAttr "Fireparti.extinction" 0.5; //*****Extinction 0.5***** setAttr "Fireparti.nonuniform" 0.5; //*****Non uniform 0.5 ***** setAttr "Fireparti.max_step_len" $VortexHeight; //***** Max step length $VortexHeight***** //*****Set Range attributes***** setAttr "FireSetRange.oldMaxX" 1; //*****old Max X 1***** setAttr "FireSetRange.oldMaxY" 1; //*****old Max Y 1***** setAttr "FireSetRange.oldMaxZ" 1; //*****old Max Z 1***** setAttr "FireSetRange.maxX" $VortexHeight; //*****Maximum X $VortexHeight***** setAttr "FireSetRange.maxY" $VortexHeight; //*****Maximum Y $VortexHeight***** setAttr "FireSetRange.maxZ" $VortexHeight; //*****Maximum Z $VortexHeight***** //*****MR Fractal attributes***** setAttr "FireMRFractal.animated" 0; //*****Animated off***** setAttr "FireMRFractal.threshold" 0.05; //*****Threshold 0.05***** setAttr "FireMRFractal.amplitude" 1; //*****Amplitude 1***** setAttr "FireMRFractal.ratio" 1; //*****Ratio 1***** setAttr "FireMRFractal.frequencyRatio" 2; //*****Frequency Ratio 2***** setAttr "FireMRFractal.depthMax" 6; //*****Depth Max 6***** setAttr "FireMRFractal.bias" 0.77; //*****Bias 0.77***** setAttr "Fireremap.color[0].color_Color" -type double3 0 0 0; //*****[0] Color 0 0 0 (black)***** setAttr "Fireremap.color[1].color_Color" -type double3 1 0.421 0.2; //*****[1] Color 1 0.421 0.2 (white-orange-yellow)***** //***** Volume noise attributes***** setAttr " FireMRVnoise.threshold" 0.28; //*****Threshold 0.28***** setAttr " FireMRVnoise.amplitude" 1; //*****Amplitude 1 ***** setAttr " FireMRVnoise.ratio" 0.8; //*****Ratio 0.8***** setAttr " FireMRVnoise.frequencyRatio" 2; //*****Frequency Ratio 2***** setAttr " FireMRVnoise.depthMax" 3; //*****Depth Max 3***** setAttr " FireMRVnoise.noiseType" 0; //*****Noise Type Perlin Noise***** //*****Dielectric Material/Photon Shader***** setAttr " FirePhoton.ior" 0.53; //*****Index of refraction 0.53***** setAttr " FirePhoton.phong_coef" 2; //*****Phong coefficient 2***** setAttr " FirePhotonM.ior" 0.53; //***** Index of refraction 0.53***** setAttr " FirePhotonM.phong_coef" 1; //*****Phong coefficient 1***** } //*****the Local procedure for smoke shader creation ***** proc Smokeshader() { //*****create particle Cloud Shader as the Main Smoke Shader***** shadingNode -asShader particleCloud -name SmokeShader; //*****create Smoke Shader (Shading Engine), connect Smoke Shader out Colour to Smoke Shader SG volume Shader***** sets -renderable true -noSurfaceShader true -empty -name SmokeShaderSG; connectAttr -f SmokeShader.outColor SmokeShaderSG.volumeShader; //*****select the smoke particles and connect it to Smoke Shader and its Shading Engine***** select -r smokeparticle ; sets -e -forceElement SmokeShaderSG; //*****set Smoke Shader attributes***** setAttr "SmokeShader.color" -type double3 0.32 0.32 0.32; //*****Colour 0.32 0.32 0.32 (dark grey)***** setAttr "SmokeShader.transparency" -type double3 0.83 0.83 0.83; //*****Transparency 0.83 0.83 0.83 (light grey)***** setAttr "SmokeShader.incandescence" -type double3 0 0 0; //*****Incandescence 0 0 0 (black)***** setAttr "SmokeShader.density" 0.1; //*****Density 0.1***** //***** create Crater and link its out Color to Smoke Shader blob Map***** shadingNode -asTexture crater -n SmokeCrater; connectAttr -force SmokeCrater.outColor SmokeShader.blobMap; //*****set Crater (Smoke Shader) attributes***** setAttr "SmokeCrater.shaker" 1.5; //*****Shaker 1.5***** setAttr "SmokeCrater.channel1" -type double3 0.8 0.72 0.67 ; //*****Channel 1 0.8 0.72 0.67 (red grey)***** setAttr "SmokeCrater.channel2" -type double3 0.22 0.22 0.23 ; //*****Channel 2 0.22 0.22 0.23 (dark grey)***** setAttr "SmokeCrater.channel3" -type double3 0.013 0.013 0.013 ; //*****Channel 3 0.013 0.013 0.013 ( black grey)***** setAttr "SmokeCrater.melt" 0.1; //*****Melt 0.1***** setAttr "SmokeCrater.balance" 0.3; //*****Balance 0.3***** setAttr "SmokeCrater.frequency" 2; //*****Frequency 2***** } //*****the Local procedure for deleting smoke shader***** proc DeleteSmokeShader() { //*****select and delete Smoke Shader and Crater***** select -add SmokeShader SmokeCrater; delete; //*****select and delete Smoke Shader (Shading Engine)***** select -r -ne SmokeShaderSG; delete; } //*****the Global procedure for enable smoke shader***** global proc EnableSmokeShader(int $state1) { //*****create a switch variable for setting the action for Enable Smoke Shader check box***** $state=`checkBox -q -v EnSmokeShader`; //*****switch function for Enable Smoke Shader check box setting***** switch ($state1) { //*****if state1 is 0, Smoke related buttons and fields are unavailable. It will delete the smoke shader***** case 0: floatFieldGrp -e -en 0 SmokeColor; floatFieldGrp -e -en 0 SmokeDensity; floatFieldGrp -e -en 0 SmokeTranspar; button -e -en 0 SmokeChange; button -e -en 0 SmokeCancelC; DeleteSmokeShader(); break; //*****if state1 is 1, Smoke related buttons and fields are available. It will create the smoke shader***** case 1: floatFieldGrp -e -en 1 SmokeColor; floatFieldGrp -e -en 1 SmokeDensity; floatFieldGrp -e -en 1 SmokeTranspar; button -e -en 1 SmokeChange; button -e -en 1 SmokeCancelC; Smokeshader(); break; //*****no default setting***** default: break; } } //*****the Local procedure for delete fire shader***** proc DeleteShader() { //*****select and delete all fire shader related components***** select -add FireCrater FireFractal FireparticleSamplerInfo Firetime FirePhotonM Fireparti FirePhoton FireBlackbody FireMRVnoise FireMRFractal FireSetRange FireBump Firelum Fireremap FireFluid FireShader; delete; //*****select the Shading Engines and delete them**** select -add -ne FireShaderSG FirePhotonMSG; delete; } //*****the Global procedure for enable fire shader***** global proc EnableShader(int $number) { //*****create a switch variable for setting Enable Shader check box actions***** $number=`checkBox -q -v EnableShader`; //*****switch function for Enable Shader check box setting***** switch ($number) { //*****if number is 0, all the Fire Shader related buttons and fields are unavailable, it will delete fire shader if the shader exists***** case 0: DeleteShader(); floatFieldGrp -e -en 0 AirD; floatFieldGrp -e -en 0 Gravity; floatFieldGrp -e -en 0 Turbul; floatFieldGrp -e -en 0 Density; floatFieldGrp -e -en 0 Temper; floatFieldGrp -e -en 0 intensity; floatFieldGrp -e -en 0 Colour; button -e -en 0 Change; button -e -en 0 CancelC; break; //*****if number is 1, all the Fire Shader related buttons and fields are available, it will create fire shader if the shader does not exist***** case 1: fireshader(); floatFieldGrp -e -en 1 AirD; floatFieldGrp -e -en 1 Gravity; floatFieldGrp -e -en 1 Turbul; floatFieldGrp -e -en 1 Density; floatFieldGrp -e -en 1 Temper; floatFieldGrp -e -en 1 intensity; floatFieldGrp -e -en 1 Colour; button -e -en 1 Change; button -e -en 1 CancelC; break; //*****no default setting***** default: break; } } //*****the Global procedure for controlling Fire whirl transform attributes***** global proc fireOtherAction(int $type1) { //*****switch function for setting Fire Whirl Transformation***** switch($type1) { //*****type1=1, Fire Whirl Translation can be controlled by user. ***** case 1: float $firepos[]; $firepos[0]=`floatFieldGrp -q -v1 FirePos`; $firepos[1]=`floatFieldGrp -q -v2 FirePos`; $firepos[2]=`floatFieldGrp -q -v3 FirePos`; setAttr "VortexCircle.tx" $firepos[0]; setAttr "VortexCircle.ty" $firepos[1]; setAttr "VortexCircle.tz" $firepos[2]; break; //*****type1=2, Fire Whirl Rotation can be controlled by user. ***** case 2: float $firerot[]; $firerot[0]=`floatFieldGrp -q -v1 FireRot`; $firerot[1]=`floatFieldGrp -q -v2 FireRot`; $firerot[2]=`floatFieldGrp -q -v3 FireRot`; setAttr "VortexCircle.rx" $firerot[0]; setAttr "VortexCircle.ry" $firerot[1]; setAttr "VortexCircle.rz" $firerot[2]; break; //*****type1=2, Fire Whirl Scale can be controlled by user. ***** case 3: float $firescale[]; $firescale[0]=`floatFieldGrp -q -v1 FireScale`; $firescale[1]=`floatFieldGrp -q -v2 FireScale`; $firescale[2]=`floatFieldGrp -q -v3 FireScale`; setAttr "VortexCircle.sx" $firescale[0]; setAttr "VortexCircle.sy" $firescale[1]; setAttr "VortexCircle.sz" $firescale[2]; break; default: break; } } //*****the Global procedure for resetting Fire whirl transform attributes***** global proc ResetTransformAction(int $type2) { //*****switch function for resetting fire whirl transformation***** switch ($type2) { //*****type2=1, reset fire whirl translation**** case 1: setAttr "VortexCircle.tx" 0; setAttr "VortexCircle.ty" 0; setAttr "VortexCircle.tz" 0; floatFieldGrp -e -v1 0.0 -v2 0.0 -v3 0.0 FirePos; break; //*****type2=2, reset fire whirl rotation**** case 2: setAttr "VortexCircle.rx" 0; setAttr "VortexCircle.ry" 0; setAttr "VortexCircle.rz" 0; floatFieldGrp -e -v1 0.0 -v2 0.0 -v3 0.0 FireRot; break; //*****type2=3, reset fire whirl scale**** case 3: setAttr "VortexCircle.sx" 1; setAttr "VortexCircle.sy" 1; setAttr "VortexCircle.sz" 1; floatFieldGrp -e -v1 1.0 -v2 1.0 -v3 1.0 FireScale; break; //*****no default setting***** default: break; } } //*****the Global procedure for changing fire shader values***** global proc ChangeValues(int $case1) { //*****User-defined Air Drag Magnitude value***** float $AirD=`floatFieldGrp -q -v1 AirD`; //*****User-defined Gravity Magnitude value***** float $Gravity=`floatFieldGrp -q -v1 Gravity`; //*****User-defined Turbulence Magnitude value***** float $Turbul=`floatFieldGrp -q -v1 Turbul`; //*****User-defined Fire Shader Density value***** float $Density=`floatFieldGrp -q -v1 Density`; //*****User-defined Fire Shader (black body) Temperature value***** float $Temper=`floatFieldGrp -q -v1 Temper`; //*****User-defined Fire Shader (black body) Intensity value***** float $Intensity=`floatFieldGrp -q -v1 intensity`; //*****User-defined Fire Shader (Fluid) Incadescence colour values (RGB)***** float $colour[]; $colour[0]=`floatFieldGrp -q -v1 Colour`; $colour[1]=`floatFieldGrp -q -v2 Colour`; $colour[2]=`floatFieldGrp -q -v3 Colour`; //*****Switch function to control the changes of the attributes***** switch ($case1) { //*****if case1 is 0, the attributes will returns to its default (original) settings***** case 0: setAttr "firedrag1.magnitude" 20; setAttr "firegravity1.magnitude" -9.8; setAttr "fireTurbul1.magnitude" 10; setAttr "FireShader.density" 0.1; setAttr "FireFluid.incandescence[1].incandescence_Color" -type double3 1 0.421 0.2; setAttr "FireBlackbody.temperature" 4600; setAttr "FireBlackbody.intensity" 1; print "Result: Cancel Change. All Values are set to default."; break; //*****if case1 is 1, the attributes can be defined by user***** case 1: setAttr "firedrag1.magnitude" $AirD; setAttr "firegravity1.magnitude" $Gravity; setAttr "fireTurbul1.magnitude" $Turbul; setAttr "FireShader.density" $Density; setAttr "FireFluid.incandescence[1].incandescence_Color" -type double3 $colour[0] $colour[1] $colour[2]; setAttr "FireBlackbody.temperature" $Temper; setAttr "FireBlackbody.intensity" $Intensity; print "Result: Fire Shader Values Change."; break; //*****no default setting***** default: break; } } //*****the Global procedure for changing smoke shader values***** global proc ChangeValuesSmoke(int $case2) { //*****User-Defined Smoke Shader Density value***** float $SmokeDensity=`floatFieldGrp -q -v1 SmokeDensity`; //*****User-Defined Smoke Shader Transparency value***** float $SmokeTransparency=`floatFieldGrp -q -v1 SmokeTranspar`; //*****User-Defined Smoke Shader Colour values (RGB)***** float $SmokeColor[]; $SmokeColor[0]=`floatFieldGrp -q -v1 SmokeColor`; $SmokeColor[1]=`floatFieldGrp -q -v2 SmokeColor`; $SmokeColor[2]=`floatFieldGrp -q -v3 SmokeColor`; //*****switch function for Smoke Shader value settings***** switch ($case2) { //*****if case2 is 0, all the available Smoke Shader attributes will set back to original***** case 0: setAttr "SmokeShader.color" -type double3 0.32 0.32 0.32; setAttr "SmokeShader.transparency" -type double3 0.83 0.83 0.83; setAttr "SmokeShader.density" 0.1; print "Result: Cancel Change. All Values are set to default."; break; //*****if case2 is 1, the available Smoke Shader attributes can be defined by user***** case 1: setAttr "SmokeShader.color" -type double3 $SmokeColor[0] $SmokeColor[1] $SmokeColor[2]; setAttr "SmokeShader.transparency" -type double3 $SmokeTransparency $SmokeTransparency $SmokeTransparency; setAttr "SmokeShader.density" $SmokeDensity; print "Result: Smoke Shader Values Change."; break; //*****no default setting***** default: break; } } //*****if the window exists, delete the old UI window***** if (`window -exists FireWin`) { deleteUI FireWin; } //*****Start of UI set up***** //*****set the UI window title, width and height***** window -in "Fire Whirl User Interface" -title "Fire Whirl User Interface" -wh 350 500 FireWin; //*****Layout the UI as tabLayout***** string $FWtabs = `tabLayout`; //*****set Coloumn layout with the row spacing 5 and adjustable***** string $FWCcol= `columnLayout -rs 5`; //columnLayout; //*****Layout the UI as frame layout, with margin width 5, collapsible and label align to centre***** //frameLayout -la "center" -mw 5 -collapsable true -label "Fire Whirl Creation" -w 350 -h 180; //columnLayout -rs 5; //*****Vortex Radius Field, default value is 1***** floatFieldGrp -l "Radius: " -cw2 160 80 -v1 1.0 Vortex_radius; //*****Vortex Height Field, default value as 1***** floatFieldGrp -l "Height: " -cw2 160 80 -v1 2.0 Vortex_height; //*****Fire Path number default value is 4***** intFieldGrp -l "Number of Path: " -cw2 160 80 -v1 4 Path_num; //*****set a rowColumnLayout for aligning the buttons***** rowColumnLayout -nc 3 -columnAttach 1 "left" 15 -columnAttach 2 "left" 15 -columnAttach 3 "left" 15; //*****Create Vortex button, to create the fire whirl model***** button -l "Create Vortex" -w 100 -en 1 -c "CreateVortex()" Vortexbutton; //*****Select Vortex button, to select the fire whirl model, it is disable when the Ui is opened ***** button -l "Select Vortex" -w 100 -en 0 -c "SelectVortex()" SelectVortex; //*****Delete Vortex button, to delete the fire whirl model***** button -l "Delete Vortex" -w 100 -en 1 -c "DeleteVortex()" DeleteVortex; //*****separate the first and second tabframes using set Parent***** setParent..; setParent..; setParent..; //*****set the 2nd Column layout with the row spacing 5**** string $FAcol= `columnLayout -rs 5 FAcolL`; //frameLayout -la "center" -mw 5 -collapsable true -label "Fire Animation" -w 350 -h 350; //columnLayout -rs 5; //*****These 3 column are parented to FAcoL***** columnLayout -rs 3 -parent FAcolL FAC1; columnLayout -rs 3 -parent FAcolL FAC2; columnLayout -rs 3 -parent FAcolL FAC3; //*****create FAC1 column***** setParent FAC1; //*****Total Seconds Field, default as 6***** floatFieldGrp -l "Total Seconds: " -v1 6.0 time; //*****Delay Field, default as 6***** floatFieldGrp -l "Delay: " -v1 0 animedelay; //*****check box is created for switch on and off of the smoke***** checkBox -l "Smoke Enable" -v 0 -onc "EnableSmoke(1)" -ofc "EnableSmoke(0)" EnableSmoke; //*****Uniform Force Field, default as 5, it is disable when the UI is opened**** floatFieldGrp -l "Uniform Force: " -cw2 165 52 -en 0 -v1 5.0 SmokeUni; //*****Vortex Force Field, default as it is disable when the UI is opened**** floatFieldGrp -l "Vortex Force: " -cw2 165 52 -en 0 -v1 4.0 SmokeVortex; //*****Vortex Fire Flow Speed Field, default as 12***** floatFieldGrp -l "Fire Flow Speed: " -cw2 165 52 -v1 12.0 FS; //*****Vortex Fire Flow Speed Offset Field, default as 0***** floatFieldGrp -l "Fire Flow Speed Offset: " -cw2 165 52 -v1 0.0 FFSO; //*****set the row Column Layout for the buttons alignment***** rowColumnLayout -nc 3 -columnAttach 1 "left" 15 -columnAttach 2 "left" 15; //*****Press Change will change the value as user input***** button -l "Change" -w 100 -c " ChangeFWValue(1) "; //*****Press Cancel will return to default values***** button -l "Cancel" -w 100 -c " ChangeFWValue(0) "; //*****create FAC2 column***** setParent FAC2; //***** the number field for inputting the seconds to start the fire animtion***** floatFieldGrp -l "Start to Fire (Sec): " -cw2 145 70 -v1 1 STF; //***** the number field for inputting the seconds to whirl up the fire path***** floatFieldGrp -l "Whirl up (Sec): " -cw2 145 70 -v1 2 WUp; //*****the number field for inputting the seconds to end the fire animtion***** floatFieldGrp -l "End in (Sec): " -cw2 145 70 -v1 5 End; //*****set row Column Layout for the buttons alignment***** rowColumnLayout -nc 3 -columnAttach 1 "left" 15 -columnAttach 2 "left" 15; //*****Press Animate button to set the keyframes according the start, whirl up and end seconds***** button -l "Animate" -w 100 -c "FireAnimate()"; //*****Press Delete Animation button to delete the keyframes according the start, whirl up and end seconds***** button -l "Cancel" -w 100 -c "DeleteFireAnime()"; //*****create FAC3 Column***** setParent FAC3; //*****check box for free set key switch***** checkBox -l "Free Set Key On/Off" -v 0 -onc " EnFireAnimeFree(1)" -ofc " EnFireAnimeFree(0)" EnableFireSFK; //*****Vortex Circle particles Rate Field***** floatFieldGrp -l "Vortex Circle Rate: " -cw2 140 70 -en 0 -v1 0 VCrate; //*****Fire path particles Rate Field***** floatFieldGrp -l "Fire Curve Rate: " -cw2 140 70 -en 0 -v1 0 FCurverate; //*****Smoke particles Rate Field***** floatFieldGrp -l "Smoke Rate: " -cw2 140 70 -en 0 -v1 0 Smokerate; //*****Current time Field***** floatFieldGrp -l "Current Time: " -cw2 140 70 -en 0 -v1 1.0 FireCurrTime; //*****set row Column layout for the button alignment***** rowColumnLayout -nc 3 -columnAttach 1 "left" 15 -columnAttach 2 "left" 15; //*****Press Set Key to insert Keyframe according to the Current Time the user input***** button -l "Set Key" -w 100 -en 0 -c " SetFireFreeKey(1)" FireSetKey; //*****Press Delete Key to delete Keyframe according to the Current Time the user input***** button -l "Delete Key" -w 100 -en 0 -c " SetFireFreeKey(2) " FireDeleteKey; //*****separate the second and third tabframes using set Parent***** setParent..; setParent..; setParent..; //*****create the column layout with row spacing 5***** string $WAcol = `columnLayout -rs 5 WRow`; //frameLayout -la "center" -mw 5 -collapsable true -label "Whirl Animation" -w 350 -h 500; //columnLayout -rs 5 WRow; //*****These 4 column layout are parented to WRow***** columnLayout -rs 3 -parent WRow WAC1; columnLayout -rs 3 -parent WRow WAC2; columnLayout -rs 3 -parent WRow WAC3; columnLayout -rs 3 -parent WRow WAC4; //*****create WAC1 column***** setParent WAC1; //*****Whirl Speed Field***** floatFieldGrp -l "Whirl Speed: " -cw2 110 70 -v1 10.0 Vortex_Speed; //*****set row Column layout for the button alignment***** rowColumnLayout -nc 2 -columnAttach 1 "left" 15 -columnAttach 2 "left" 15; //*****Press Animate to set the whirl speed keyframes according to Whirl Speed input**** button -l "Animate" -w 100 -c "AnimateVortex()" ; //*****Press Delete Animation to delete the whirl speed keyframes according to Whirl Speed input**** button -l "Cancel" -w 100 -c "DeleteKey()"; //*****create WAC2 column***** setParent WAC2; //*****check box for the choice of adding bones to the fire whirl model***** checkBox -l "Add Bone" -v 0 -ofc "EnableBone(0)" -onc "EnableBone(1)" CBB; //*****Spin Speed Field***** floatFieldGrp -l "Spin Speed: " -cw2 130 70 -en 0 -v1 10.0 Spin_Speed; //*****Spin Velocity Field***** floatFieldGrp -l "Spin Velocity: " -cw2 130 70 -en 0 -v1 10.0 Spin_Vel; //*****Spin Radius for even bones Field***** floatFieldGrp -l "Spin Radius1: " -cw2 130 70 -en 0 -v1 1.0 Spin_Radius1; //*****Spin Radius for odd bones Field***** floatFieldGrp -l "Spin Radius2: " -cw2 130 70 -en 0 -v1 1.0 Spin_Radius2; //*****set row Column layout for the button alignment***** rowColumnLayout -nc 3 -columnAttach 1 "left" 15 -columnAttach 2 "left" 15; //*****Press Animate for setting bones Keyframes***** button -l "Animate" -w 100 -en 0 -c "Animatebone()" AnimateB; //*****Press Delete for deleting bones Keyframes***** button -l "Cancel" -w 100 -en 0 -c "DeleteAllBoneAnime()" DeleteB; //*****create WAC3 cloumn***** setParent WAC3; //*****Free Set Key switch***** checkBox -l "Free Set Key On/Off" -v 0 -onc "enableSetFreeKey(1)" -ofc "enableSetFreeKey(0)" EnableSFK; //*****Bone ID Field for bone selection***** intFieldGrp -l "Bone ID: " -cw2 80 70 -en 0 -v1 1 BoneID; //*****set row Column layout for the button alignment***** rowColumnLayout -nc 1 -columnAttach 1 "left" 15; //*****bone selected when Press***** button -l "Select Bone" -w 100 -en 0 -c "SelectBone()" SelectBone; //*****create WAC4 Column****** setParent WAC4; //*****Current Time Field***** floatFieldGrp -l "Current Time: " -en 0 -v1 1.0 -cw2 110 80 CurrTime; //*****Bone Position XYZ Field***** floatFieldGrp -nf 3 -l "Bone Position: " -en 0 -w 250 -cw4 115 43 43 43 Bonepos; //*****set row Column layout for the button alignment***** rowColumnLayout -nc 3 -columnAttach 1 "left" 15 -columnAttach 2 "left" 15; //*****Press Set Key to set Keyframes to a bone according to current time input***** button -l "Set Key" -w 100 -en 0 -c "KeyCurrTime(1)" SetKey; //*****Press Delete Key to delete Keyframes to a bone according to current time input***** button -l "Delete Key" -w 100 -en 0 -c "KeyCurrTime(2)" DeleteKey; //*****separate the third and fourth tabframes using set Parent***** setParent..; setParent..; setParent..; setParent..; //*****create row Layout with 3 columns due to multiple fields and buttons**** string $FWTArow = `rowLayout -nc 3 MainRow`; //frameLayout -la "center" -mw 5 -collapsable true -label "Fire Whirl Transfrom Attributes" -w 350 -h 250; //rowLayout -nc 3 MainRow; //*****These 3 columns are parented to MainRow***** columnLayout -rs 3 -columnAttach "left" 0 -parent MainRow C1; columnLayout -rs 2 -columnAttach "left" 118 -parent MainRow C2; columnLayout -rs 2 -columnAttach "left" 72 -parent MainRow C3; //*****create C1 column***** setParent C1; //*****Fire Whirl Position XYZ Field***** floatFieldGrp -nf 3 -l "Position: " -w 202 -cw4 76 43 43 43 FirePos; //*****Fire Whirl Rotation XYZ Field***** floatFieldGrp -nf 3 -l "Rotation: " -w 202 -cw4 76 43 43 43 FireRot; //*****Fire Whirl Scale XYZ Field***** floatFieldGrp -nf 3 -l "Scale: " -w 202 -cw4 76 43 43 43 -v1 1 -v2 1 -v3 1 FireScale; //*****Free Animation Enable switch***** checkBox -l "Animation On/Off" -v 0 -onc " enableFreeTransformKey(1)" -ofc " enableFreeTransformKey(0)" EnableFTK; //*****Current Time Field***** floatFieldGrp -l "Current Time: " -cw2 110 70 -en 0 -v1 1.0 CurrTimeT; //*****set row Column layout for the button alignment***** rowColumnLayout -nc 2 -columnAttach 1 "left" 15 -columnAttach 2 "left" 15; //*****Press Set Key to insert Keyframe to the assigned Current time***** button -l "Set Key" -en 0 -w 100 -c "SetTransformKey(1)" SetTKey; //*****Press Delete Key to delete Keyframe from the assigned Current time***** button -l "Delete Key" -en 0 -w 100 -c "SetTransformKey(2) " DeleteTKey; //*****create C2 Column***** setParent C2; //***** Press to move the fire whirl model with the assigned position values***** button -l "Move" -w 55 -c "fireOtherAction(1)"; //***** Press to rotate the fire whirl model with the assigned rotation values***** button -l "Rotate" -w 55 -c "fireOtherAction(2)"; //***** Press to Scale the fire whirl model with the assigned scale values***** button -l "Scale" -w 55 -c "fireOtherAction(3)"; //*****create C3 Column***** setParent C3; //*****Reset position to default values***** button -l "Reset" -w 55 -c "ResetTransformAction(1)"; //*****Reset rotation to default values***** button -l "Reset" -w 55 -c "ResetTransformAction(2)"; //*****Reset scale to default values***** button -l "Reset" -w 55 -c "ResetTransformAction(3)"; //*****separate the third and fourth tabframes using set Parent***** setParent..; setParent..; setParent..; setParent..; //*****create column layout with row spacing 7 and column attach left 4***** string $FWScol= `columnLayout -rs 7 -columnAttach "left" 4 FWScol`; //frameLayout -la "center" -mw 5 -collapsable true -label "Fire Whirl Shader" -w 350 -h 600; //columnLayout -rs 7 -columnAttach "left" 0 ; //*****These 2 Columns are parented to FWScol***** columnLayout -rs 5 -parent FWScol FWScol1; columnLayout -rs 5 -parent FWScol FWScol2; //*****create FWScol1 Column***** setParent FWScol1; //*****Title : Fire Shader***** text -l "Fire Shader" -fn "smallBoldLabelFont" -w 110; //*****Fire Shader On/Off switch***** checkBox -l "Fire Shader On/Off" -v 0 -onc "EnableShader(1)" -ofc "EnableShader(0)" EnableShader; //*****Subtitle: Black Body Emission Change***** text -l "Black Body Emission Change" -fn "smallPlainLabelFont" -w 180; //*****Temperature Field in Black Body Node, unit is Kelvin***** floatFieldGrp -l "Temperature: " -en 0 -v1 1000 Temper; //*****Intensity Field in Black Body Node***** floatFieldGrp -l "Intensity: " -en 0 -v1 1 intensity; //*****Subtitle: General Properties Change ***** text -l "General Properties Change" -fn "smallPlainLabelFont" -w 180; //*****Air Drag Field in Drag Node***** floatFieldGrp -l "Air Drag: " -en 0 -v1 20 AirD; //*****Gravity Field in Gravity Node***** floatFieldGrp -l "Gravity: " -en 0 -v1 -9.8 Gravity; //***** Turbulence Field in Turbulence Node***** floatFieldGrp -l "Turbulence: " -en 0 -v1 10 Turbul; //***** Density Field in Fire Shader***** floatFieldGrp -l "Density: " -en 0 -v1 0.1 Density; //***** Colour (Incandescence) in Fire Fluid***** floatFieldGrp -nf 3 -l "Colour: " -en 0 -v1 1 -v2 0.421 -v3 0.2 -w 350 -cw4 90 43 43 43 Colour; //*****set row Column layout for the button alignment***** rowColumnLayout -nc 2 -columnAttach 1 "left" 15 -columnAttach 2 "left" 15; //*****Press Change to change the above Fire Shader properties according to user input***** button -l "Change" -en 0 -w 100 -c "ChangeValues(1) " Change; //*****Press Cancel Change to return the values to default setting***** button -l "Cancel Change" -en 0 -w 100 -c "ChangeValues(0) " CancelC; //*****create FWScol2 Column***** setParent FWScol2; //*****Title: Smoke Shader***** text -l "Smoke Shader" -fn "smallBoldLabelFont" -w 130; //*****Smoke Shader switch***** checkBox -l "Smoke Shader On/Off" -v 0 -onc "EnableSmokeShader(1)" -ofc "EnableSmokeShader(0)" EnSmokeShader; //*****Smoke Shader Density Field ***** floatFieldGrp -l "Density: " -en 0 -cw2 120 80 -v1 0.1 SmokeDensity; //*****Smoke Shader Transparency Field ***** floatFieldGrp -l "Transparency: " -en 0 -cw2 120 80 -v1 0.8 SmokeTranspar; //*****Smoke Shader Colour (RGB) Field ***** floatFieldGrp -nf 3 -l "Colour: " -en 0 -v1 0.3 -v2 0.3 -v3 0.3 -w 300 -cw4 80 43 43 43 SmokeColor; //*****set row Column layout for the button alignment***** rowColumnLayout -nc 2 -columnAttach 1 "left" 15 -columnAttach 2 "left" 15; //*****Press Change to change the above Smoke Shader properties according to user input***** button -l "Change" -en 0 -w 100 -c "ChangeValuesSmoke(1) " SmokeChange; //*****Press Cancel Change to return the values to default setting***** button -l "Cancel Change" -en 0 -w 100 -c "ChangeValuesSmoke(0) " SmokeCancelC; //*****Arrange tab Layout with tab frames labels***** tabLayout -edit -tabLabel $FWCcol "Fire Whirl Creation" -tabLabel $FAcol "Fire Animation" -tabLabel $WAcol "Whirl Animation" -tabLabel $FWTArow "Fire Whirl Transfrom Attributes" -tabLabel $FWScol "Fire Whirl Shader" $FWtabs; //*****Show Window***** showWindow FireWin;