CheckBoxGrp Help - novice question

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
Old 01 January 2011   #1
CheckBoxGrp Help - novice question

So this was done as a way to teach myself how to use vectors, since I've never worked with them before. Anyway, ignore that for now. What I really need help with (right now) is the GUI, more specifically the check box groups.

I want the ALL boxes to, by default, be checked on, however, when I add the "-v1 1", I get this error:
// Error: line 124: Invalid object or value: 1 //

I'm not sure what to do. I've read the help and it looks like everything it set up correctly. Could someone take a look for me? If there's a better way to do this, please let me know.

I'm still learning, so I need a lot of help. The script isn't done, but if you see anything that sticks out so far, let me know. And use small words

Thanks.

Code:
//////////////////////////////////////////////////////////////// // Name: Align Script (50%) // // Author: Melissa Starks // // Description: This script allows the user to align one // // object with one (or more) object(s) based on // // translation and/or rotation. // //////////////////////////////////////////////////////////////// /*General notes: //goal - final resting place target - items to be moved TO DO: Finish scripting Create the GUI link all proc's to proper GUI elements Bug testing */ //////////////////////////////////////////////////////////////// //START OF SCRIPT // //////////////////////////////////////////////////////////////// //Copies all transformation values from Goal //transformAll(1,1,1,1,1,1); global proc transformAll(int $doTx, int $doTy, int $doTz, int $doRx, int $doRy, int $doRz) { //int $doTx = 1; int $doTy = 1; int $doTz=1; int $doRx = 1; int $doRy = 1; int $doRz = 1; //---> 1) Query Goal's position (this is the last item selected) string $sel[] = `ls -sl`; //Query everything selected int $sizeSel = `size $sel`; //Query how many items are in the string $goal = $sel[$sizeSel-1]; //Selects the goal //println = $goal; vector $transGoal = `xform -q -t -ws $goal`; //Queries the goals position in space vector $rotGoal = `xform -q -ro -ws $goal`; //Queries the goals position in space //print $transGoal; //Queries the position of all of the targets int $xp; for($xp=0;$xp<($sizeSel-1);$xp++){ //$xp=0; //---> 2) Query Target's position vector $transTarget = `xform -q -t -ws $sel[$xp]`; println ($transTarget + "\n"); vector $rotTarget = `xform -q -ro -ws $sel[$xp]`; println ($rotTarget + "\n"); //---> 3) Pick and choose values from the goal or target as necessary /*if($doTx) $transTarget = ($transGoal.x) ($transTarget.y) ($transTarget.z); if($doTy) $transTarget = ($transTarget.x) ($transGoal.y) ($transTarget.z); if($doTz) $transTarget = ($transTarget.x) ($transTarget.y) ($transGoal.z); if($doRx) $rotTarget = ($rotGoal.x) ($rotTarget.y) ($rotTarget.z); if($doRy) $rotTarget = ($rotTarget.x) ($rotGoal.y) ($rotTarget.z); if($doRz) $rotTarget = ($rotTarget.x) ($rotTarget.y) ($rotGoal.z); */ float $xpos = ($transTarget.x); float $ypos = ($transTarget.y); float $zpos = ($transTarget.z); float $xrot = ($rotTarget.x); float $yrot = ($rotTarget.y); float $zrot = ($rotTarget.z); if($doTx) $xpos = ($transGoal.x); if($doTy) $ypos = ($transGoal.y); if($doTz) $zpos = ($transGoal.z); if($doRx) $xrot = ($rotGoal.x); if($doRy) $yrot = ($rotGoal.y); if($doRz) $zrot = ($rotGoal.z); //---> 4) Move Target to new position print ("Moving to: "+$xpos+" "+$ypos+" "+$zpos+"\n"); xform -ws -t $xpos $ypos $zpos $sel[$xp]; xform -ws -ro $xrot $yrot $zrot $sel[$xp]; } } //the GUI global proc alignGUI(){ string $win; if (`window -exists $win`){ deleteUI -window $win; } string $win = `window -wh 400 400 -rtf true -sizeable false -title "Align Objects"`; string $alignGUIFrame = `frameLayout -cl off -labelVisible true -label "Align Axes:" -borderVisible true -collapsable false -width 400`; columnLayout; //text -l "Translate:" $transButtonGrp = `checkBoxGrp -numberOfCheckBoxes 1 -label "Translate:" -labelArray2 "ALL" tranAll`; //int $qT = `checkBoxGrp -query -v1 tranAll`; $transButtonGrp2 = `checkBoxGrp -numberOfCheckBoxes 3 -label "" -labelArray3 "X" "Y" "Z" tXYZBoxes`; //checkBoxGrp -q -value1 tXYZBoxes; setParent..; columnLayout; $rotButtonGrp = `checkBoxGrp -numberOfCheckBoxes 1 -label "Rotate:" -labelArray2 "ALL" -v1 1 rotAll`; $transButtonGrp2 = `checkBoxGrp -numberOfCheckBoxes 3 -label "" -labelArray3 "X" "Y" "Z" -v1 0 -v2 0 -v3 0 rXYZBoxes`; setParent..; //int $qTB = `checkBoxGrp -q -v2 rXYZBoxes`; //print $qTB separator -style "in" -w 400 -h 5; rowColumnLayout -numberOfRows 1; button -label "Apply" -command (""); button -label "Close" -command "deleteUI -window win"; showWindow $win; } global proc doAlignGUI(){ //get info from alignGUI and pass it to transformAll proc //---> 1) Get info from GUI //---> 2) Call transformAll, passing along the info from GUI } //////////////////////////////////////////////////////////////// //END OF SCRIPT // ////////////////////////////////////////////////////////////////
 
Old 01 January 2011   #2
the problem you mention is due to the fact that your checkBoxGrp command creates ONE checkbox, but you use the -labelArray2 flag, then only give it one label: "ALL". So it's seeing -v1 as the SECOND label in the label array!

also, a frameLayout can only take a single layout as a child, and you have given three (two columnLayouts and a rowLayout!) so you will also probably need to fix this.

:nathaN
 
Old 01 January 2011   #3
Great!

Thanks for the quick response! I was going insane, but that explanation makes so much sense.

I'll fix the frameLayout issue too and repost when I get a little farther.
 
Old 01 January 2011   #4
Thread automatically closed

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.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 05:10 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.