Maya is a tricky one...
This sort of thing happens sometimes, as with the ls -sl
; command. You need to define the limits or what you return from querying the floatFieldGrps as float values. For some reason, Maya must be thinking that they're something else. This happens with the ls -sl
; command, in that even if it returns "" or one item, it returns it in an array, so you can get a similar error. To fix your code, just put float before each declaration for $transMin and max... as such:
CODE
{
//main window
if (window -exists randomizerWindow
) {
deleteUI -window randomizerWindow;
}
string $myRandomWindow = window -title "tkRandom" -wh 400 325 randomizerWindow
;
columnLayout -columnAttach "both" 5 -rowSpacing 5 -columnWidth 400;
floatFieldGrp -label "Translate Min Range" -numberOfFields 3 transMin;
floatFieldGrp -label "Translate Max Range" -numberOfFields 3 transMax;
separator;
button -label "Randomize!!!" -c "randomize" randomizeButton;
showWindow $myRandomWindow;
//procedure
proc randomize() {
float $transXMin = floatFieldGrp -q -value1 transMin
;
float $transYMin = floatFieldGrp -q -value2 transMin
;
float $transZMin = floatFieldGrp -q -value3 transMin
;
float $transXMax = floatFieldGrp -q -value1 transMax
;
float $transYMax = floatFieldGrp -q -value2 transMax
;
float $transZMax = floatFieldGrp -q -value3 transMax
;
string $sel[] = ls -sl
;
for ($myObject in $sel) {
float $transXRand = rand $transXMin $transXMax
;
float $transYRand = rand $transYMin $transYMax
;
float $transZRand = rand $transZMin $transZMax
;
move $transXRand $transYRand $transZRand;
}
}
}