Dichotomy
10-10-2003, 11:36 PM
OK, so I am trying to create a GUI window that will show the lights in a scene and have a second window that will allow you to link or unlink the light from every object in the scene... my problem is that the $lightNum variable works almost the whole script but then, when called for in the button command, it says that it is undeclared...??
I know this might not be the prettiest script, but it is just for practice more than anything. If anyone can tell me why the error is occuring I would appreciate it.
Here's the script:
global string $lightTransfer;
global string $lightsArray[];
proc link()
{
global string $lightTransfer;
global string $lightsArray[];
string $objects[] = `ls -g -dag`;
string $current;
string $winLinkName = "linkWindow";
string $linkMain = "lightLinkWindow";
if (`window -exists $winLinkName`)
{
deleteUI $winLinkName;
}
window -t "linkWindow" $winLinkName;
scrollLayout;
columnLayout;
frameLayout -l $lightTransfer -cll true;
for ($current in $objects)
{
rowColumnLayout -nc 1 -cw 1 500 ($linkMain);
text $lightTransfer;
checkBox -l $current -onc ("lightlink -light $lightTransfer -object $current") -ofc ("lightlink -break -light $lightTransfer -object $current");
setParent $linkMain;
}
showWindow $winLinkName;
}
global proc lights()
{
string $sel[] =`ls -lights`;
string $currentLights;
string $winName = "lightControls";
string $main = "mainWindow";
global string $lightTransfer;
global string $lightsArray[];
int $lightNum = 1;
if (`window -exists $winName`)
{
deleteUI $winName;
}
window -t "lightControls" $winName;
scrollLayout;
rowColumnLayout -nc 1 -cw 1 700 ($main);
for ($currentLights in $sel)
{
$lightsArray[$lightNum] = $currentLights;
frameLayout -l $currentLights -cll true;
rowColumnLayout -nc 3 -cw 1 400 -cw 2 100 -cw 3 100;
text $lightsArray[$lightNum];
attrFieldSliderGrp -min -1 -max 10 -at ($currentLights +".intensity");
button -l "links" -c ("link");
button -l "loadLight" -c ("$lightTransfer = $lightsArray[$lightNum]*****ERROR HERE*****");
setParent $main;
$lightNum++;
}
showWindow $winName;
}
I know this might not be the prettiest script, but it is just for practice more than anything. If anyone can tell me why the error is occuring I would appreciate it.
Here's the script:
global string $lightTransfer;
global string $lightsArray[];
proc link()
{
global string $lightTransfer;
global string $lightsArray[];
string $objects[] = `ls -g -dag`;
string $current;
string $winLinkName = "linkWindow";
string $linkMain = "lightLinkWindow";
if (`window -exists $winLinkName`)
{
deleteUI $winLinkName;
}
window -t "linkWindow" $winLinkName;
scrollLayout;
columnLayout;
frameLayout -l $lightTransfer -cll true;
for ($current in $objects)
{
rowColumnLayout -nc 1 -cw 1 500 ($linkMain);
text $lightTransfer;
checkBox -l $current -onc ("lightlink -light $lightTransfer -object $current") -ofc ("lightlink -break -light $lightTransfer -object $current");
setParent $linkMain;
}
showWindow $winLinkName;
}
global proc lights()
{
string $sel[] =`ls -lights`;
string $currentLights;
string $winName = "lightControls";
string $main = "mainWindow";
global string $lightTransfer;
global string $lightsArray[];
int $lightNum = 1;
if (`window -exists $winName`)
{
deleteUI $winName;
}
window -t "lightControls" $winName;
scrollLayout;
rowColumnLayout -nc 1 -cw 1 700 ($main);
for ($currentLights in $sel)
{
$lightsArray[$lightNum] = $currentLights;
frameLayout -l $currentLights -cll true;
rowColumnLayout -nc 3 -cw 1 400 -cw 2 100 -cw 3 100;
text $lightsArray[$lightNum];
attrFieldSliderGrp -min -1 -max 10 -at ($currentLights +".intensity");
button -l "links" -c ("link");
button -l "loadLight" -c ("$lightTransfer = $lightsArray[$lightNum]*****ERROR HERE*****");
setParent $main;
$lightNum++;
}
showWindow $winName;
}
