a6u5t
12-20-2007, 06:08 AM
Can someone please help me with my script; Maya says Error without anymore explanation. I'm trying to create a particle and a field, with the script. I've added notes where the possible problem is likely to occur. (2 of them, I think). Would appreciate any help, I'm not a programmer.
global proc asParticlesFields4 ()
{
string $winName = ` window -title "Particles and Fields" `;
columnLayout;
text -label "Playback Range";
intField playback;
text -label "EMITER";
text -label "Rate";
floatSliderGrp -field true rate;
text -label "Speed";
floatSliderGrp -field true speed;
text -label "Speed random";
floatSliderGrp -field true speedR;
//possible problem1//
string $groupR1 = `radioButtonGrp -numberOfRadioButtons 4 - label "What kind of FIELDS?" -labelArray4 "Newton" "Radial" "Turbulence" "Vortex" which `;
radioButtonGrp -numberOfRadioButtons 4 -shareCollection $groupR1 -label "" -labelArray4 "Air" "Drag" "Gravity" "Uniform" which2;
radioButtonGrp -numberOfRadioButtons 2 -shareCollection $groupR1 -label "" -labelArray2 "Volume Axis" "No Fields" which3;
text -label "Magnitude";
floatSliderGrp -field true magnitude;
text -label "Attenuation";
floatSliderGrp -field true attenuation;
button -label "Execute" -command "testIt3()";
showWindow $winName;
}
global proc testIt3()
{
int $playrange = `intField -query -value playback `;
float $rat = ` floatSliderGrp -query -value rate `;
float $sped = ` floatSliderGrp -query -value speed `;
float $spedr = ` floatSliderGrp -query -value speedR `;
//possible problem 2//
int $whichFields = ` radioButtonGrp -query -select which1 which2 which3 `;
float $mag = ` floatSliderGrp -query -value magnitude `;
float $att = ` floatSliderGrp -query -value attenuation `;
playbackOptions -minTime 0 -maxTime $playrange;
string $theEmitter[] = ` emitter -pos 0 0 0 -type omni -r $rat -speed $sped -speedRandom $spedr `;
string $parBucket[] = ` particle `;
connectDynamic -em emitter1 particle1;
select -clear;
switch ($whichFields)
{
case 1:
string $theFields[] = ` newton -m $mag -att $att `;
select -clear;
connectDynamic -f newtonFields1 particle1;
break;
case 2:
string $theFields[] = `radial -m $mag -att $att `;
break;
case 3:
string $theFields[] = `turbulence -m $mag -att $att `;
break;
case 4:
string $theFields[] = `vortex -m $mag -att $att `;
break;
case 5:
string $theFields[] = `air -m $mag -att $att `;
break;
case 6:
string $theFields[] = `drag -m $mag -att $att `;
break;
case 7:
string $theFields[] = `gravity -m $mag -att $att `;
break;
case 8:
string $theFields[] = `uniform -m $mag -att $att `;
break;
case 9:
string $theFields[] = `volumeAxis -m $mag -att $att `;
break;
case 10:
break;
}
}
global proc asParticlesFields4 ()
{
string $winName = ` window -title "Particles and Fields" `;
columnLayout;
text -label "Playback Range";
intField playback;
text -label "EMITER";
text -label "Rate";
floatSliderGrp -field true rate;
text -label "Speed";
floatSliderGrp -field true speed;
text -label "Speed random";
floatSliderGrp -field true speedR;
//possible problem1//
string $groupR1 = `radioButtonGrp -numberOfRadioButtons 4 - label "What kind of FIELDS?" -labelArray4 "Newton" "Radial" "Turbulence" "Vortex" which `;
radioButtonGrp -numberOfRadioButtons 4 -shareCollection $groupR1 -label "" -labelArray4 "Air" "Drag" "Gravity" "Uniform" which2;
radioButtonGrp -numberOfRadioButtons 2 -shareCollection $groupR1 -label "" -labelArray2 "Volume Axis" "No Fields" which3;
text -label "Magnitude";
floatSliderGrp -field true magnitude;
text -label "Attenuation";
floatSliderGrp -field true attenuation;
button -label "Execute" -command "testIt3()";
showWindow $winName;
}
global proc testIt3()
{
int $playrange = `intField -query -value playback `;
float $rat = ` floatSliderGrp -query -value rate `;
float $sped = ` floatSliderGrp -query -value speed `;
float $spedr = ` floatSliderGrp -query -value speedR `;
//possible problem 2//
int $whichFields = ` radioButtonGrp -query -select which1 which2 which3 `;
float $mag = ` floatSliderGrp -query -value magnitude `;
float $att = ` floatSliderGrp -query -value attenuation `;
playbackOptions -minTime 0 -maxTime $playrange;
string $theEmitter[] = ` emitter -pos 0 0 0 -type omni -r $rat -speed $sped -speedRandom $spedr `;
string $parBucket[] = ` particle `;
connectDynamic -em emitter1 particle1;
select -clear;
switch ($whichFields)
{
case 1:
string $theFields[] = ` newton -m $mag -att $att `;
select -clear;
connectDynamic -f newtonFields1 particle1;
break;
case 2:
string $theFields[] = `radial -m $mag -att $att `;
break;
case 3:
string $theFields[] = `turbulence -m $mag -att $att `;
break;
case 4:
string $theFields[] = `vortex -m $mag -att $att `;
break;
case 5:
string $theFields[] = `air -m $mag -att $att `;
break;
case 6:
string $theFields[] = `drag -m $mag -att $att `;
break;
case 7:
string $theFields[] = `gravity -m $mag -att $att `;
break;
case 8:
string $theFields[] = `uniform -m $mag -att $att `;
break;
case 9:
string $theFields[] = `volumeAxis -m $mag -att $att `;
break;
case 10:
break;
}
}
