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 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


 // 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
 Finish scripting
 Create the GUI
 	link all proc's to proper GUI elements
 	Bug testing
 //START OF SCRIPT											 //
 //Copies all transformation values from Goal
 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;
 		//---> 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
 			$transTarget = ($transGoal.x) ($transTarget.y) ($transTarget.z);
 			$transTarget = ($transTarget.x) ($transGoal.y) ($transTarget.z);
 			$transTarget = ($transTarget.x) ($transTarget.y) ($transGoal.z);
 			$rotTarget = ($rotGoal.x) ($rotTarget.y) ($rotTarget.z);
 			$rotTarget = ($rotTarget.x) ($rotGoal.y) ($rotTarget.z);
 			$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);
 			$xpos = ($transGoal.x);
 			$ypos = ($transGoal.y);
 			$zpos = ($transGoal.z);
 			$xrot = ($rotGoal.x);
 			$yrot = ($rotGoal.y);
 			$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`;
 		//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;
 		$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`;
 	//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.

Old 01 January 2011   #3

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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
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
Society of Digital Artists

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

All times are GMT. The time now is 11:32 AM.

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