// =========================================================================== // 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. // =========================================================================== // // // Creation Date: 7 Oct 1998 // // Procedure Name: // rebuildCurveCallback // // Description: // Update the option values with the current state of the option box UI. // // Input Arguments: // parent - Top level parent layout of the option box UI. Required so // that UI object names can be successfully resolved. // // doIt - Whether the command should execute. // // Return Value: // None. // global proc rebuildCurveCallback( string $parent, int $doIt, string $goToTool ) { if( "" != $goToTool ) { optionVar -iv rebuildCurveEuc `scriptCtx -q -euc $goToTool`; optionVar -iv rebuildCurveLac `scriptCtx -q -lac $goToTool`; } setParent $parent; // Set the optionVar's from the current control values, and then perform // the command // int $rebuildType = `radioButtonGrp -q -select rebuildTypeRadioGroup1`; if( $rebuildType == 0 ) { $rebuildType = `radioButtonGrp -q -sl rebuildTypeRadioGroup2`; if( $rebuildType == 0) { $rebuildType = `radioButtonGrp -q -sl rebuildTypeRadioGroup3`; $rebuildType += 2; // to compensate for the 2 btns in Group2 } $rebuildType += 3; // to compensate for the 3 btns in Group1 } $rebuildType -= 1; // change 1-based index to zero-based index int $numSpans = `intSliderGrp -q -value numSpansIntSliderGrp`; int $degreeBtn123 = `radioButtonGrp -q -select rebuildCrvDegree123`; int $degreeBtn57 = `radioButtonGrp -q -select rebuildCrvDegree57`; int $degree; switch($degreeBtn123) { case 1: $degree = 1; break; case 2: $degree = 2; break; case 3: $degree = 3; break; default: switch($degreeBtn57) { case 1: $degree = 5; break; case 2: $degree = 7; break; default: $degree = 3; break; } break; } int $endKnots = `radioButtonGrp -q -select endKnotsRadioButtonGrp` - 1; int $keepRange = `radioButtonGrp -q -select keepRangeRadioButtonGrp` - 1; int $keepEndPts = `checkBoxGrp -query -v1 keepCheckBoxGrp`; int $keepTan = `checkBoxGrp -query -v2 keepCheckBoxGrp`; int $keepControlPoints = `checkBoxGrp -query -v3 keepCheckBoxGrp`; int $keepNumSpans = `checkBoxGrp -q -v4 keepCheckBoxGrp`; int $useGlobalTol = 2 - `radioButtonGrp -q -select toleranceRadioButtonGrp`; float $localtol = `floatSliderGrp -q -value localTolFloatFieldGrp`; int $keepOrig = 0; if( `checkBoxGrp -q -exists keepOriginalCheckBox` ) { $keepOrig = `checkBoxGrp -query -v1 keepOriginalCheckBox`; } optionVar -intValue rebuildCurveType $rebuildType; optionVar -intValue rebuildCurveTypeUniformNumSpans $numSpans; optionVar -intValue rebuildCurveTypeUniformDegree $degree; optionVar -intValue rebuildCurveEndKnots $endKnots; optionVar -intValue rebuildCurveKeepRange $keepRange; optionVar -intValue rebuildCurveKeepEndPoints $keepEndPts; optionVar -intValue rebuildCurveKeepEndTangents $keepTan; optionVar -intValue rebuildCurveKeepControlPoints $keepControlPoints; optionVar -intValue rebuildCurveKeepNumSpans $keepNumSpans; optionVar -intValue rebuildCurveUseGlobalTolerance $useGlobalTol; optionVar -floatValue rebuildCurveLocalTolerance $localtol; optionVar -intValue rebuildCurveKeepOriginal $keepOrig; if( 1 == $doIt ) { performRebuildCurve( 0, $goToTool ); string $tmpCmd = "performRebuildCurve( 0, \"" + $goToTool + "\")"; addToRecentCommandQueue $tmpCmd "Rebuild Curve"; } else if( $doIt ) { setToolTo $goToTool; } }