PDA

View Full Version : Am I an idiot???


BPorter
05-09-2007, 07:25 AM
Hello all, when I execute this script I get an error "too many arguments: expected 1, found 2"... I know for a fact that the error is the on and off commands for the checkbox groups. If I execute selCamShape by itself, it works perfectly. If anyone knows why it thinks it's getting 2 args, please let me know.

Here's the first one I tried

global proc zAlphaWin ()
{

if (`window -exists zAlphaWin`)

deleteUI zAlphaWin;



window

-width 200

-rtf 1

zAlphaWin;

columnLayout -adjustableColumn 1 zAlphaMainCol;

string $allCams[] = `listCameras`;

for ($each in $allCams)

checkBoxGrp

-label $each

-adj 1

-ncb 2

-labelArray2 "Alpha" "Z-Depth"

-of1 "selCamShape ($each,".mask",0)"

-on1 "selCamShape ($each,".mask",1)"

-of2 "selCamShape ($each,".depth",0)"

-on2 "selCamShape ($each,".depth",1)"

($each + "CBGrp");

button -label "Render" renderAllButton;

showWindow zAlphaWin;

}

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

global proc selCamShape (string $cam, string $attr, int $switch)
{

string $camShape[] = `pickWalk -d "down" $cam`;

setAttr ($camShape[0] + $attr) $switch;

}


////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////

here's the 2nd one

global proc zAlphaWin ()
{
if (`window -exists zAlphaWin`)
deleteUI zAlphaWin;

window
-width 200
-rtf 1
zAlphaWin;
columnLayout -adjustableColumn 1 zAlphaMainCol;
string $allCams[] = `listCameras`;
for ($each in $allCams)
checkBoxGrp
-label $each
-ncb 2
-label1 "Alpha"
-label2 "Z-Depth"
// -of1 "setAttr (`selCamShape $each` + ".mask") 0"
// -on1 "setAttr (`selCamShape $each` + ".mask") 1"
// -of2 "setAttr (`selCamShape $each` + ".depth") 0"
// -on2 "setAttr (`selCamShape $each` + ".depth") 1"
($each + "CBGrp");
button -label "Render" renderAllButton;
showWindow zAlphaWin;
}
------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------

global proc string selCamShape (string $cam)
{
string $camShape[] = `pickWalk -d "down" $cam`;
return $camShape[0];
}

Sick Spider
05-09-2007, 03:17 PM
There you go.
You have to put the command in an escape.

global proc zAlphaWin ()
{
if (`window -exists zAlphaWin`)
deleteUI zAlphaWin;

window -width 200 -rtf 1 "zAlphaWin";
columnLayout -adjustableColumn 1 "zAlphaMainCol";
string $allCams[] = `ls -type "camera" -type "shape"`;
for ($each in $allCams)
{
checkBoxGrp -label $each -adj 1 -ncb 2 -labelArray2 "Alpha" "Z-Depth"

-of1 ("selCamShape \""+$each+"\"\" mask\" 0")

-on1 ("selCamShape \""+$each+"\"\" mask\" 1")

-of2 ("selCamShape \""+$each+"\"\" depth\" 0")

-on2 ("selCamShape \""+$each+"\"\" depth\" 1")

($each + "CBGrp");
}
separator;
button -label "Render" renderAllButton;
showWindow zAlphaWin;

}
zAlphaWin();

And than ....

global proc selCamShape (string $cam, string $attr, int $switch)
{
setAttr ($cam +"."+ $attr) $switch;
}


OR......
Even with only one proc !

global proc zAlphaWin ()
{
if (`window -exists zAlphaWin`)
deleteUI zAlphaWin;

window -width 200 -rtf 1 "zAlphaWin";
columnLayout -adjustableColumn 1 "zAlphaMainCol";
string $allCams[] = `ls -type "camera" -type "shape"`;
for ($each in $allCams)
{
checkBoxGrp -label $each -adj 1 -ncb 2 -labelArray2 "Alpha" "Z-Depth"

-of1 ("setAttr \""+$each+" .mask\" 0")

-on1 ("setAttr \""+$each+" .mask\" 1")

-of2 ("setAttr \""+$each+" .depth\" 0")

-on2 ("setAttr \""+$each+" .depth\" 1")

($each + "CBGrp");
}
separator;
button -label "Render" renderAllButton;
showWindow zAlphaWin;

}
zAlphaWin();


Have fun.

CGTalk Moderation
05-09-2007, 03:17 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.