// =========================================================================== // Copyright 2018 Autodesk, Inc. All rights reserved. // // Use of this software is subject to the terms of the Autodesk license // agreement provided at the time of installation or download, or which // otherwise accompanies this software in either electronic or hard copy form. // =========================================================================== // dynFloatMinMax.mel // This proc contains utility routines needed by various files. // //----------------------- dynFloatMinMax ------------------------------ // // Set the new control value in the context and adjust the floatSiderGrp // range if the user has gone beyond the current slider min/mix. // global proc dynFloatMinMax(string $toolName, string $contextName, string $controlName, string $flag, int $fieldMin, int $fieldMax) { // If the user has typed in a number greater than the current // slider range, adjust the slider range to go from 0 to twice // the new value. // // Get the new value typed in, and the current max and min. // float $newValue = `floatSliderGrp -q -v $controlName`; float $currMaxValue = `floatSliderGrp -q -max $controlName`; float $currMinValue = `floatSliderGrp -q -min $controlName`; // Set the new value in the context. // eval($contextName+" -e "+$flag+" "+$newValue+" "+$toolName); if ($newValue < $currMinValue) { // If the new new value is less than the current minimum, // set the max value to 0, and the min value to newValue * 2 // float $newMax = 0.0; float $newMin = $newValue * 2; floatSliderGrp -e -min $newMin -fmn $fieldMin -max $newMax -fmx $fieldMax -step 0.5 $controlName; } else if ($newValue > $currMaxValue) { // If the new new value is greater than the current maximum, // set the min value to 0 and the max value to newValue * 2 // float $newMin = 0.0; float $newMax = $newValue * 2; floatSliderGrp -e -min $newMin -fmn $fieldMin -max $newMax -fmx $fieldMax -step 0.5 $controlName; } }