// =========================================================================== // 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 createPolySphereValues(string $toolName) { string $name = "createPolySphere"; string $parent = (`toolPropertyWindow -q -location` + "|" + $name); setParent $parent; int $wDiv = `createPolySphereCtx -q -sw $toolName`; int $hDiv = `createPolySphereCtx -q -sh $toolName`; float $rad = `createPolySphereCtx -q -radius $toolName`; int $uvSetting = `createPolySphereCtx -q -createUVs $toolName`; int $createUV = 0; int $pinched = 0; int $sawtooth = 0; int $select = 1; if ($uvSetting == 2){ $createUV = 1; $sawtooth = 1; $select = 1; } else if ($uvSetting == 1){ $createUV = 1; $pinched = 1; $select = 2; } int $axis = `createPolySphereCtx -q -axis $toolName`; int $dragEdit = `createPolySphereCtx -q -doDragEdit $toolName`; intSliderGrp -e -v $wDiv -cc ("createPolySphereCtx -e -sw #1 " + $toolName) createPolySphereWidthDivisionsSlider; intSliderGrp -e -v $hDiv -cc ("createPolySphereCtx -e -sh #1 " + $toolName) createPolySphereHeightDivisionsSlider; floatSliderGrp -e -v $rad -cc ("createPolySphereCtx -e -radius #1 " + $toolName) createPolySphereRadiusSlider; radioButtonGrp -e -sl ($axis + 1) -cc ("changeSphereAxisSetting(\"" + $toolName+ "\")") createPolySphereAxisRadioButton; checkBoxGrp -e -v1 $createUV -cc1 ("changeSphereUVSettings(\"" + $toolName+ "\")") createPolySphereCreateUVCheckBox; radioButtonGrp -e -sl $select -cc ("changeSphereUVSettings(\"" + $toolName+ "\")") createPolySphereUVPoleTypeRadioButton; checkBoxGrp -e -v1 $dragEdit -cc1 ("createPolySphereCtx -e -doDragEdit " + !$dragEdit + " " + $toolName) createPolySphereDragEditCheckBox; string $icon = "polySphere.png"; string $helpTag= "CreatePolySphereTool"; toolPropertySetCommon $toolName $icon $helpTag; toolPropertySelect $name; changeSphereUVSettings($toolName); } global proc changeSphereAxisSetting(string $toolName){ int $axisSetting = 0; if (`radioButtonGrp -exists createPolySphereAxisRadioButton`){ $axisSetting = (`radioButtonGrp -q -sl createPolySphereAxisRadioButton` - 1); } if ($axisSetting < 0){ $axisSetting = 0; } string $cmd = "createPolySphereCtx -e -axis " + $axisSetting + " " + $toolName; eval($cmd); } global proc changeSphereUVSettings(string $toolName) { int $value = 0; int $createUVVal; int $pinchedVal; int $sawtoothVal; if (`checkBoxGrp -exists createPolySphereCreateUVCheckBox`){ $createUVVal = `checkBoxGrp -q -v1 createPolySphereCreateUVCheckBox`; } if (`radioButtonGrp -exists createPolySphereUVPoleTypeRadioButton`){ $pinchedVal = `radioButtonGrp -q -sl createPolySphereUVPoleTypeRadioButton`; $sawtoothVal = `radioButtonGrp -q -sl createPolySphereUVPoleTypeRadioButton`; } if ($createUVVal){ radioButtonGrp -edit -enable true createPolySphereUVPoleTypeRadioButton; }else { radioButtonGrp -edit -enable false createPolySphereUVPoleTypeRadioButton; } if ($sawtoothVal == 1){ $sawtoothVal = 1; } else { $sawtoothVal = 0; } if ($pinchedVal == 2){ $pinchedVal = 1; } else { $pinchedVal = 0; } if($createUVVal && $sawtoothVal){ $value = 2; } else if ($createUVVal){ $value = 1; } string $cmd = ("createPolySphereCtx -edit -cuv " + $value + " " + $toolName); eval($cmd); }