PDA

View Full Version : Stumped on floatFieldGrp


cakesson
03-12-2009, 06:59 PM
If you have a floatFieldGrp with more than one float field how do you know which value changed when you pass it to another proc? There is only one change command.....

Any ideas?

Thanks,

/Christian

TroyC
03-13-2009, 11:59 PM
Well I think I was able to do what your asking using global variables to store the current value of each field...


global float $field01;
global float $field02;
global float $field03;
string $window = `window`;
columnLayout;
floatFieldGrp
-numberOfFields 3
-cc "checkField"
theFloatFieldGrp;
showWindow $window;

$field01 = `floatFieldGrp -q -value1 theFloatFieldGrp`;
$field02 = `floatFieldGrp -q -value2 theFloatFieldGrp`;
$field03 = `floatFieldGrp -q -value3 theFloatFieldGrp`;

global proc checkField(){
global float $field01;
global float $field02;
global float $field03;

float $newField01 = `floatFieldGrp -q -value1 theFloatFieldGrp`;
float $newField02 = `floatFieldGrp -q -value2 theFloatFieldGrp`;
float $newField03 = `floatFieldGrp -q -value3 theFloatFieldGrp`;

if($newField01 != $field01) print "Field 01 was changed. \n";
if($newField02 != $field02) print "Field 02 was changed. \n";
if($newField03 != $field03) print "Field 03 was changed. \n";

$field01 = `floatFieldGrp -q -value1 theFloatFieldGrp`;
$field02 = `floatFieldGrp -q -value2 theFloatFieldGrp`;
$field03 = `floatFieldGrp -q -value3 theFloatFieldGrp`;
}


But I really wouldn't use this in a script. It seems to me that the floatFieldGrp is meant to be used for things where the fields are all updating together. If you're doing something like setting translation values then it doesn't really matter if all channels get set because only the one you change actually does anything. I guess if you want separate change commands you have to use the floatField. :shrug:

cakesson
03-15-2009, 11:36 PM
Cool, thanks for the reply. Yea, I ended up just replacing the floatFieldGrp with individual floatFields. Seems to me that this controller could use a -cc, -cc1, cc2 etc - similar to the checkboxGrp. Would be useful for situations like this.

Thanks for taking the time to post and coming up with that work around.

Cheers,

/Christian

CGTalk Moderation
03-15-2009, 11:36 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.