// =========================================================================== // 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 createNurbsCubeValues(string $toolName) { string $name = "createNurbsCube"; string $parent = (`toolPropertyWindow -q -location` + "|" + $name); setParent $parent; // Get values from context // int $uPatches = `createNurbsCubeCtx -q -uPatches $toolName`; int $vPatches = `createNurbsCubeCtx -q -vPatches $toolName`; int $axisType = `createNurbsCubeCtx -q -axisType $toolName`; float $axis[3] = `createNurbsCubeCtx -q -axis $toolName`; int $surfDeg = `createNurbsCubeCtx -q -surfaceDegree $toolName`; float $w = `createNurbsCubeCtx -q -width $toolName`; float $d = `createNurbsCubeCtx -q -depth $toolName`; float $h = `createNurbsCubeCtx -q -height $toolName`; int $dragEdit = `createNurbsCubeCtx -q -doDragEdit $toolName`; // Set control values and callbacks // if( $axisType < 4 ) { radioButtonGrp -edit -select $axisType createNurbsCubeAxisType1RadioButtonGrp; } else { radioButtonGrp -edit -select ($axisType - 3) createNurbsCubeAxisType2RadioButtonGrp; } radioButtonGrp -edit -onCommand1 ("floatFieldGrp -e -value 1.0 0.0 0.0 0.0 createNurbsCubeAxisFieldsFloatGrp; createNurbsCubeCtx -edit -axisType 1 -axis 1 0 0 " + $toolName ) -onCommand2 ("floatFieldGrp -e -value 0.0 1.0 0.0 0.0 createNurbsCubeAxisFieldsFloatGrp; createNurbsCubeCtx -edit -axisType 2 -axis 0 1 0 " + $toolName ) -onCommand3 ("floatFieldGrp -e -value 0.0 0.0 1.0 0.0 createNurbsCubeAxisFieldsFloatGrp; createNurbsCubeCtx -edit -axisType 3 -axis 0 0 1 " + $toolName ) createNurbsCubeAxisType1RadioButtonGrp; radioButtonGrp -edit -onCommand1 ("createNurbsCubeCtx -edit -axisType 4 -axis " + "`floatFieldGrp -query -value1 createNurbsCubeAxisFieldsFloatGrp` " + "`floatFieldGrp -query -value2 createNurbsCubeAxisFieldsFloatGrp` " + "`floatFieldGrp -query -value3 createNurbsCubeAxisFieldsFloatGrp` " + $toolName ) -onCommand2 ("float $axis[] = `nurbsViewDirectionVector 1`; createNurbsCubeCtx -edit -axisType 5 -axis $axis[0] $axis[1] $axis[2] " + $toolName ) createNurbsCubeAxisType2RadioButtonGrp; floatFieldGrp -edit -enable ($axisType == 4) -value $axis[0] $axis[1] $axis[2] 0.0 -changeCommand ("createNurbsCubeCtx -e -axis #1 #2 #3 " + $toolName) -value1 $axis[0] -value2 $axis[1] -value3 $axis[2] createNurbsCubeAxisFieldsFloatGrp; intSliderGrp -e -v $uPatches -cc ("createNurbsCubeCtx -e -uPatches #1 " + $toolName) createNurbsCubeUPatchesSlider; intSliderGrp -e -v $vPatches -cc ("createNurbsCubeCtx -e -vPatches #1 " + $toolName) createNurbsCubeVPatchesSlider; radioButtonGrp -edit -onCommand1 ("createNurbsCubeCtx -e -surfaceDegree 1 " + $toolName) -onCommand2 ("createNurbsCubeCtx -e -surfaceDegree 2 " + $toolName) -onCommand3 ("createNurbsCubeCtx -e -surfaceDegree 3 " + $toolName) createNurbsCubeSurfaceDegree1RadioButtonGrp; radioButtonGrp -edit -onCommand1 ("createNurbsCubeCtx -e -surfaceDegree 5 " + $toolName) -onCommand2 ("createNurbsCubeCtx -e -surfaceDegree 7 " + $toolName) createNurbsCubeSurfaceDegree2RadioButtonGrp; if ($surfDeg <= 3) { radioButtonGrp -edit -select $surfDeg createNurbsCubeSurfaceDegree1RadioButtonGrp; } else if ($surfDeg == 5) { radioButtonGrp -edit -select 1 createNurbsCubeSurfaceDegree2RadioButtonGrp; } else if ($surfDeg == 7) { radioButtonGrp -edit -select 2 createNurbsCubeSurfaceDegree2RadioButtonGrp; } floatSliderGrp -e -v $w -cc ("createNurbsCubeCtx -e -width #1 " + $toolName) createNurbsCubeWidthSlider; floatSliderGrp -e -v $d -cc ("createNurbsCubeCtx -e -depth #1 " + $toolName) createNurbsCubeDepthSlider; floatSliderGrp -e -v $h -cc ("createNurbsCubeCtx -e -height #1 " + $toolName) createNurbsCubeHeightSlider; checkBoxGrp -e -v1 $dragEdit -cc1 ("createNurbsCubeCtx -e -doDragEdit " + !$dragEdit + " " + $toolName) createNurbsCubeDragEditCheckBox; string $icon = "cube.png"; string $helpTag= "CreateNurbsCubeTool"; toolPropertySetCommon $toolName $icon $helpTag; toolPropertySelect $name; }