View Full Version : multiple attr syntax
Scott212 07-23-2003, 04:16 PM ok so I'm kinda new at this...
If I'm building a slider GUI and I want slider1 to effect all three scale attributes of a cube, how do I insert three attributes into the -at flag?
ex:
$cage = "lightBoxCage";
attrFieldSliderGrp -l "Light Area" -min 0 -max 50 -at ($cage + ".scaleX") areaSlider;
Also... I want to run an if/else statement to determine if an object is present and react accordingly. I can't seem to get it to work like this:
$box = "box";
if ($box=1) {
rename "nurbsTorus1" "there";
} else {
rename "nurbsTorus1" "notThere";
}
I don't get any errors - I just don't get the desired result. What am I doing wrong?
Thanks mates
|
|
ajk48n
07-23-2003, 08:42 PM
1st question:
string $object[] = `sphere`;
string $window = `window -title "attrFieldGrp Example"`;
columnLayout;
attrFieldGrp -attribute ($object[0] + ".scale");
showWindow;
That will give 3 fields that are connected to scale. If you want to use the slider, then I think you need 3 different sliders.
attrFieldSliderGrp -l "ScaleX" -min 0 -max 50 -at ($object[0]+ ".scaleX") areaSliderX;
attrFieldSliderGrp -l "ScaleY" -min 0 -max 50 -at ($object[0]+ ".scaleX") areaSliderY;
attrFieldSliderGrp -l "ScaleZ" -min 0 -max 50 -at ($object[0]+ ".scaleX") areaSliderZ;
2nd Question"
if (`objExists box`) {
print "YES";
}
else {
print "NO";
}
Note: If there's only one statement under the if or else statements, you don't need the brackets.
dwalden74
07-24-2003, 08:00 AM
If you use a floatSlider instead of an attrFieldSliderGrp, you can tell that slider to affect the X Y and Z rotations with the "-changeCommand" or "-dragCommand" flags.
:beer:
David
Scott212
07-24-2003, 05:04 PM
>> ajk48n Thanks so much man - it worked like a charm! :beer:
>> dwalden74 That sounds like a good method, would it be possible for an example? Please Please pretty Please?
dwalden74
07-24-2003, 07:25 PM
sphere -n "sphere";
window winTemp;
columnLayout;
floatSlider
-dc "setAttr sphere.sx `floatSlider -q -v sliderTemp`;\
setAttr sphere.sy `floatSlider -q -v sliderTemp`;\
setAttr sphere.sz `floatSlider -q -v sliderTemp`;"
sliderTemp;
showWindow winTemp;
Scott212
07-25-2003, 03:20 AM
is there a way to check if multiple objects exist without running the procedure each time? I'm trying string arrays with no luck. :annoyed:
ajk48n
07-26-2003, 04:51 AM
Try this:
string $test[];
$test[0] = "box";
$test[1] = "asd";
$test[2] = "cube";
int $i;
for ($i = 0; $i < size($test); $i++)
{
if (`objExists $test[$i]`)
{
print ("\n" + $test[$i] + " YES");
}
else
{
print ("\n" + $test[$i] + " NO");
}
}
CGTalk Moderation
01-15-2006, 05:00 PM
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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.