// =========================================================================== // 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. // =========================================================================== global proc createNurbsCylinderValues(string $toolName) { string $name = "createNurbsCylinder"; string $parent = (`toolPropertyWindow -q -location` + "|" + $name); setParent $parent; float $startSweep = `createNurbsCylinderCtx -q -startSweep $toolName`; float $endSweep = `createNurbsCylinderCtx -q -endSweep $toolName`; int $sections = `createNurbsCylinderCtx -q -sections $toolName`; int $spans = `createNurbsCylinderCtx -q -spans $toolName`; float $rad = `createNurbsCylinderCtx -q -radius $toolName`; float $h = `createNurbsCylinderCtx -q -height $toolName`; int $surfDeg = `createNurbsCylinderCtx -q -surfaceDegree $toolName`; int $axisType = `createNurbsCylinderCtx -q -axisType $toolName`; float $axis[3] = `createNurbsCylinderCtx -q -axis $toolName`; int $caps = `createNurbsCylinderCtx -q -caps $toolName`; int $exTrCaps = `createNurbsCylinderCtx -q -extraTransformOnCaps $toolName`; int $toleranceType = (`createNurbsCylinderCtx -q -toleranceType $toolName`); int $tolerance = `createNurbsCylinderCtx -q -tolerance $toolName`; int $dragEdit = `createNurbsCylinderCtx -q -doDragEdit $toolName`; // Set control values and callbacks // if( $axisType < 4 ) { radioButtonGrp -edit -select $axisType createNurbsCylinderAxisType1RadioButtonGrp; } else { radioButtonGrp -edit -select ($axisType - 3) createNurbsCylinderAxisType2RadioButtonGrp; } radioButtonGrp -edit -onCommand1 ("floatFieldGrp -e -value 1.0 0.0 0.0 0.0 createNurbsCylinderAxisFieldsFloatGrp; createNurbsCylinderCtx -edit -axisType 1 -axis 1 0 0 " + $toolName ) -onCommand2 ("floatFieldGrp -e -value 0.0 1.0 0.0 0.0 createNurbsCylinderAxisFieldsFloatGrp; createNurbsCylinderCtx -edit -axisType 2 -axis 0 1 0 " + $toolName ) -onCommand3 ("floatFieldGrp -e -value 0.0 0.0 1.0 0.0 createNurbsCylinderAxisFieldsFloatGrp; createNurbsCylinderCtx -edit -axisType 3 -axis 0 0 1 " + $toolName ) createNurbsCylinderAxisType1RadioButtonGrp; radioButtonGrp -edit -onCommand1 ("createNurbsCylinderCtx -edit -axisType 4 -axis " + "`floatFieldGrp -query -value1 createNurbsCylinderAxisFieldsFloatGrp` " + "`floatFieldGrp -query -value2 createNurbsCylinderAxisFieldsFloatGrp` " + "`floatFieldGrp -query -value3 createNurbsCylinderAxisFieldsFloatGrp` " + $toolName ) -onCommand2 ("float $axis[] = `nurbsViewDirectionVector 1`; createNurbsCylinderCtx -edit -axisType 5 -axis $axis[0] $axis[1] $axis[2] " + $toolName ) createNurbsCylinderAxisType2RadioButtonGrp; floatFieldGrp -edit -enable ($axisType == 4) -value $axis[0] $axis[1] $axis[2] 0.0 -changeCommand ("createNurbsCylinderCtx -e -axis #1 #2 #3 " + $toolName) -value1 $axis[0] -value2 $axis[1] -value3 $axis[2] createNurbsCylinderAxisFieldsFloatGrp; radioButtonGrp -e -select ($surfDeg == 3 ? 2 : 1) -onCommand1 ("createNurbsCylinderCtx -e -surfaceDegree 1 " + $toolName) -onCommand2 ("createNurbsCylinderCtx -e -surfaceDegree 3 " + $toolName) createNurbsCylinderSurfaceDegreeRadioButtonGrp; floatSliderGrp -e -v $startSweep -cc ("createNurbsCylinderCtx -e -startSweep #1 " + $toolName) createNurbsCylinderStartSweepSlider; floatSliderGrp -e -v $endSweep -cc ("createNurbsCylinderCtx -e -endSweep #1 " + $toolName) createNurbsCylinderEndSweepSlider; intSliderGrp -e -v $sections -cc ("createNurbsCylinderCtx -e -sections #1 " + $toolName) createNurbsCylinderSectionsSlider; intSliderGrp -e -v $spans -cc ("createNurbsCylinderCtx -e -spans #1 " + $toolName) createNurbsCylinderSpansSlider; radioButtonGrp -edit -select $toleranceType -onCommand1 ("createNurbsCylinderCtx -edit -toleranceType 1 -useTolerance 0 " + $toolName) -onCommand2 ("createNurbsCylinderCtx -edit -toleranceType 2 -useTolerance 1 -tolerance `floatSliderGrp -query -value createNurbsCylinderToleranceSlider` " + $toolName) -onCommand3 ("createNurbsCylinderCtx -edit -toleranceType 3 -useTolerance 1 " + $toolName) createNurbsCylinderToleranceRadioButtonGrp; if( $toleranceType == 1 ){ tabLayout -edit -visible true -selectTab createNurbsCylinderTabWithoutTolerance createNurbsCylinderTabLayoutForTolerance; } else { if( $toleranceType == 2 ){ tabLayout -edit -visible true -selectTab createNurbsCylinderTabWithTolerance createNurbsCylinderTabLayoutForTolerance; } else { tabLayout -edit -visible false createNurbsCylinderTabLayoutForTolerance; } } floatSliderGrp -edit -value $tolerance -changeCommand ("createNurbsCylinderCtx -edit -tolerance #1 " + $toolName) createNurbsCylinderToleranceSlider; radioButtonGrp -e -select ($caps + 1) -onCommand ("createNurbsCylinderCtx -e -caps (`radioButtonGrp -q -select createNurbsCylinderCapsRadioButtonGrp` - 1) " + $toolName) createNurbsCylinderCapsRadioButtonGrp; checkBoxGrp -e -value1 $exTrCaps -cc ("createNurbsCylinderCtx -e -extraTransformOnCaps #1 " + $toolName) createNurbsCylinderExtraTransformOnCapsCheckBox; floatSliderGrp -e -v $rad -cc ("createNurbsCylinderCtx -e -radius #1 " + $toolName) createNurbsCylinderRadiusSlider; floatSliderGrp -e -v $h -cc ("createNurbsCylinderCtx -e -height #1 " + $toolName) createNurbsCylinderHeightSlider; checkBoxGrp -e -v1 $dragEdit -cc1 ("createNurbsCylinderCtx -e -doDragEdit " + !$dragEdit + " " + $toolName) createNurbsCylinderDragEditCheckBox; string $icon = "cylinder.png"; string $helpTag= "CreateNurbsCylinderTool"; toolPropertySetCommon $toolName $icon $helpTag; toolPropertySelect $name; }