cppgraphics
10-10-2011, 05:48 AM
hello folks,
whats wrong in the following code? I'm trying to set goalUV while moving a floating Slider Grp control. But Im unable to get the updated goal value instantly. It makes me to play the animation and rewind it manually. How to solve this?
proc globalPosition_Update() {
global string $objName[], $lightType, $randGlobalPosition, $lightParticle[];
global int $particleCount;
float $gV[], $gU[];
int $randTest, $partID, $value;
float $positionDetail[];
if ($objName[0]=="") {
error ("No Object is Selected");
}
for ($partID=0; $partID < $particleCount; $partID++)
{
$randTest= rand(0.0,2.0);
$gU = `getParticleAttr -at goalU ($lightParticle[1] + ".pt[" + $partID + "]")`;
$gV = `getParticleAttr -at goalV ($lightParticle[1] + ".pt[" + $partID + "]")`;
if (abs($randTest) == 0) {
setParticleAttr -at goalU -fv ($gU[0] + 0.01) ($lightParticle[1] + ".pt[" + $partID + "]");
setParticleAttr -at goalV -fv ($gV[0] + 0.01) ($lightParticle[1] + ".pt[" + $partID + "]");
}
if (abs($randTest) == 1) {
setParticleAttr -at goalU -fv ($gU[0] - 0.01) ($lightParticle[1] + ".pt[" + $partID + "]");
setParticleAttr -at goalV -fv ($gV[0] - 0.01) ($lightParticle[1] + ".pt[" + $partID + "]");
}
}
runup -mxf 25;
refresh;
currentTime -update true 1;
}
whats wrong in the following code? I'm trying to set goalUV while moving a floating Slider Grp control. But Im unable to get the updated goal value instantly. It makes me to play the animation and rewind it manually. How to solve this?
proc globalPosition_Update() {
global string $objName[], $lightType, $randGlobalPosition, $lightParticle[];
global int $particleCount;
float $gV[], $gU[];
int $randTest, $partID, $value;
float $positionDetail[];
if ($objName[0]=="") {
error ("No Object is Selected");
}
for ($partID=0; $partID < $particleCount; $partID++)
{
$randTest= rand(0.0,2.0);
$gU = `getParticleAttr -at goalU ($lightParticle[1] + ".pt[" + $partID + "]")`;
$gV = `getParticleAttr -at goalV ($lightParticle[1] + ".pt[" + $partID + "]")`;
if (abs($randTest) == 0) {
setParticleAttr -at goalU -fv ($gU[0] + 0.01) ($lightParticle[1] + ".pt[" + $partID + "]");
setParticleAttr -at goalV -fv ($gV[0] + 0.01) ($lightParticle[1] + ".pt[" + $partID + "]");
}
if (abs($randTest) == 1) {
setParticleAttr -at goalU -fv ($gU[0] - 0.01) ($lightParticle[1] + ".pt[" + $partID + "]");
setParticleAttr -at goalV -fv ($gV[0] - 0.01) ($lightParticle[1] + ".pt[" + $partID + "]");
}
}
runup -mxf 25;
refresh;
currentTime -update true 1;
}
