PDA

View Full Version : floatSlider feedback...


alesmav
10-23-2003, 08:40 AM
Ih!

I have succesfully managed to drive the object rotation with a floatSlider. The object rotation has a min and a max value based on the min/max value of the slider. Also every time I start the UI with a slider, it reads the rotation value of the object and puts the slider in the position of that value. Here's the code:

make a poly cube and run the script:


-----------------------------------------------------------------------------
float $sliderValue1 = `getAttr ("pCube1.rx")`;

if (`window -q -ex cubeRotate`==true) deleteUI cubeRotate;
window -w 500 -h 500 -t "cube Rotate" cubeRotate;

string $form = `formLayout base`;
setParent $form;

string $slider1 = `floatSlider
-w 20
-h 80
-minValue 0 -maxValue 360
-dc "slider1"
-hr false
-value $sliderValue1 slider1 `;

showWindow cubeRotate;

proc slider1 ()

{
float $slider1value = `floatSlider -q -v slider1`;
setAttr ("pCube1.rx") $slider1value;
};

------------------------------------------------------------------------------


Now what I would like to know is how to achieve that when I rotate the cube itself, the slider gets automatically updated.

Any ideas?

ALES

dwalden74
10-27-2003, 07:49 PM
Now what I would like to know is how to achieve that when I rotate the cube itself, the slider gets automatically updated.

For that you need a two-way connection. This can be done with an attrFieldSliderGrp, or (I believe) via the connectControl command.

alesmav
10-27-2003, 11:24 PM
Yes, I just found out yesterday, connectControl is the thing!

thanks...

ALES

CGTalk Moderation
01-16-2006, 11:00 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.