PDA

View Full Version : check box queue


h0tice
08-28-2003, 05:51 PM
hi there mel gurus,

i am currently developing a UI for my lights and got some problem with my check box, here is the mel:

global proc GI_Window()
{

string $myGIWindow = "GIWindow";
if (`window -ex $myGIWindow`)
{
deleteUI $myGIWindow;
}
string $shadOn_sun = `setAttr "Sun.sunShadows" 1`;
string $shadOff_sun = `setAttr "Sun.sunShadows" 0`;

window -w 450 -h 500 -t ("Dome GI Light Editor") $myGIWindow;


scrollLayout -hst 16 -vst 16 -childResizable true;
columnLayout -adj 1;

frameLayout -l "Sun Light Attributes" -w 450 -labelAlign "center" -borderStyle "etchedIn"
-cll true -cl true;

columnLayout -adj 1;
separator -style "double" -w 450 -h 4;

attrColorSliderGrp -w 450 -adjustableColumn 1 -attribute ("Sun.sunColor") -l "Color";
separator -style "in" -w 450 -h 4;
attrFieldSliderGrp -w 450 -adjustableColumn 1 -attribute ("Sun.sunIntensity") -l "Intensity";
separator -style "in" -w 450 -h 4;
checkBox -l "Sun Shadow" -onc "$shadOn_sun" -ofc "$shadOff_sun" -cc "OnOffSunShad();" sunShadow;
separator -style "in" -w 450 -h 4;
attrColorSliderGrp -w 450 -adjustableColumn 1 -attribute ("Sun.sunShadowColor") -l "Shadow Color";
separator -style "in" -w 450 -h 4;


setParent..;
setParent..;
showWindow $myGIWindow;
}


global proc OnOffSunShad()
{

int $OnOff = `checkBox -q -value sunShadow`;

if ($OnOff)
{setAttr "Sun.sunShadows" 1;}
else
{setAttr "Sun.sunShadows" 0;}
}

the window shows after the script is executed but when trying to test the check box there is no effect in the attribute of my curve, i use curve to drive the attributes of my six directional light in the scene.

do i have an error or something?

thanx a lot

GDC
08-28-2003, 06:09 PM
At a quick glance of your code I would loose the lines:

string $shadOn_sun = `setAttr "Sun.sunShadows" 1`;
string $shadOff_sun = `setAttr "Sun.sunShadows" 0`;

and change you checkBox command to:

checkBox -l "Sun Shadow" -cc "OnOffSunShad();" sunShadow;

This way wjen ever the state changes, the proc OnOffSunShad, will handle setting the attribute.

--g

h0tice
08-28-2003, 06:21 PM
thanx for that quick one gdc, it works like a charm.

:applause: :thumbsup:

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