// =========================================================================== // 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. // =========================================================================== // dynIntMinMax.mel // This proc contains utility routines needed by various files. // //----------------------- dynIntMinMax ------------------------------ // // Set the new control value in the context and adjust the intSliderGrp // range if the user has gone beyond the current slider min/mix. // global proc dynIntMinMax(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. // int $newValue = `intSliderGrp -q -v $controlName`; int $currMaxValue = `intSliderGrp -q -max $controlName`; int $currMinValue = `intSliderGrp -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 // int $newMax = 0.0; int $newMin = $newValue * 2; intSliderGrp -e -min $newMin -fmn $fieldMin -max $newMax -fmx $fieldMax -step 1 $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 // int $newMin = 0.0; int $newMax = $newValue * 2; intSliderGrp -e -min $newMin -fmn $fieldMin -max $newMax -fmx $fieldMax -step 1 $controlName; } }