PDA

View Full Version : MEL setting goalUV from floatSliderGrp


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;
}

martin8910
10-15-2011, 10:15 PM
What about just get the rewind back and forth in the script itself:

//Ask for current time
float $currentTime = `currentTime -q`;
//Go one frame foreward
currentTime ($currentTime + 1);
//Go back to startframe
currentTime ($currentTime);

cppgraphics
10-16-2011, 03:41 AM
What about just get the rewind back and forth in the script itself:

//Ask for current time
float $currentTime = `currentTime -q`;
//Go one frame foreward
currentTime ($currentTime + 1);
//Go back to startframe
currentTime ($currentTime);


hi martin,

"runup" command does the same, it will play the scene and update. But no use.

CGTalk Moderation
10-16-2011, 03:41 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.