// =========================================================================== // 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 createPolyConeValues(string $toolName) { string $name = "createPolyCone"; string $parent = (`toolPropertyWindow -q -location` + "|" + $name); setParent $parent; int $wDiv = `createPolyConeCtx -q -sw $toolName`; int $hDiv = `createPolyConeCtx -q -sh $toolName`; int $dDiv = `createPolyConeCtx -q -sd $toolName`; int $roundCap = `createPolyConeCtx -q -roundCap $toolName`; int $createUV = 1; int $normalize = 1; int $preserveAR = 1; float $rad = `createPolyConeCtx -q -radius $toolName`; float $h = `createPolyConeCtx -q -height $toolName`; int $uvSetting = `createPolyConeCtx -q -createUVs $toolName`; $createUV = 0; $normalize = 0; $preserveAR = 0; if ($uvSetting == 3){ $createUV = 1; $normalize = 1; $preserveAR = 1; } else if ($uvSetting == 2){ $createUV = 1; $normalize = 1; } else if ($uvSetting == 1){ $createUV = 1; } int $axis = `createPolyConeCtx -q -axis $toolName`; int $dragEdit = `createPolyConeCtx -q -doDragEdit $toolName`; int $dragEditCaps = `createPolyConeCtx -q -doSubdivisionsCapsEdit $toolName`; intSliderGrp -e -v $wDiv -cc ("createPolyConeCtx -e -sw #1 " + $toolName) createPolyConeWidthDivisionsSlider; intSliderGrp -e -v $hDiv -cc ("createPolyConeCtx -e -sh #1 " + $toolName) createPolyConeHeightDivisionsSlider; intSliderGrp -e -v $dDiv -cc ("createPolyConeCtx -e -sd #1 " + $toolName) createPolyConeDepthDivisionsSlider; checkBoxGrp -e -v1 $roundCap -cc1 ( "createPolyConeCtx -e -roundCap #1 " + $toolName + ";" + "if(#1 && `createPolyConeCtx -query -subdivisionsDepth " + $toolName + "` == 0)" + "{ createPolyConeCtx -edit -subdivisionsDepth 1 " + $toolName + ";}") createPolyConeRoundCapCheckBox; radioButtonGrp -e -sl ($axis + 1) -cc ("changeConeAxisSetting(\"" + $toolName+ "\")") createPolyConeAxisRadioButton; checkBoxGrp -e -v1 $createUV -cc1 ("changeConeUVSettings(\"" + $toolName+ "\")") createPolyConeCreateUVCheckBox; checkBoxGrp -e -v1 $normalize -cc1 ("changeConeUVSettings(\"" + $toolName+ "\")") createPolyConeNormalizeCheckBox; checkBoxGrp -e -v1 $preserveAR -cc1 ("changeConeUVSettings(\"" + $toolName+ "\")") createPolyConePreserveAspectRatioCheckBox; floatSliderGrp -e -v $rad -cc ("createPolyConeCtx -e -radius #1 " + $toolName) createPolyConeRadiusSlider; floatSliderGrp -e -v $h -cc ("createPolyConeCtx -e -height #1 " + $toolName) createPolyConeHeightSlider; checkBoxGrp -e -v1 $dragEdit -cc1 ("createPolyConeCtx -e -doDragEdit " + !$dragEdit + " " + $toolName) createPolyConeDragEditCheckBox; int $doDrag = `checkBoxGrp -q -v1 createPolyConeDragEditCheckBox`; if ($doDrag) checkBoxGrp -edit -enable true createPolyConeCapsDragEditCheckBox; else checkBoxGrp -edit -enable false createPolyConeCapsDragEditCheckBox; checkBoxGrp -e -v1 $dragEditCaps -cc1 ("createPolyConeCtx -e -doSubdivisionsCapsEdit " + !$dragEditCaps + " " + $toolName) createPolyConeCapsDragEditCheckBox; string $icon = "polyCone.png"; string $helpTag= "CreatePolyConeTool"; toolPropertySetCommon $toolName $icon $helpTag; toolPropertySelect $name; changeConeUVSettings($toolName); } global proc changeConeAxisSetting(string $toolName){ int $axisSetting = 0; if (`radioButtonGrp -exists createPolyConeAxisRadioButton`){ $axisSetting = (`radioButtonGrp -q -sl createPolyConeAxisRadioButton` - 1); } if ($axisSetting < 0){ $axisSetting = 0; } string $cmd = "createPolyConeCtx -e -axis " + $axisSetting + " " + $toolName; eval($cmd); } global proc changeConeUVSettings(string $toolName) { int $value = 0; int $createUVVal; int $normalizeVal; int $preserveARVal; if (`checkBoxGrp -exists createPolyConeCreateUVCheckBox`){ $createUVVal = `checkBoxGrp -q -v1 createPolyConeCreateUVCheckBox`; } if (`checkBoxGrp -exists createPolyConeNormalizeCheckBox`){ $normalizeVal = `checkBoxGrp -q -v1 createPolyConeNormalizeCheckBox`; } if (`checkBoxGrp -exists createPolyConePreserveAspectRatioCheckBox`){ $preserveARVal = `checkBoxGrp -q -v1 createPolyConePreserveAspectRatioCheckBox`; } if ($createUVVal){ checkBoxGrp -edit -enable true createPolyConeNormalizeCheckBox; if ($normalizeVal){ checkBoxGrp -edit -enable true createPolyConePreserveAspectRatioCheckBox; }else { checkBoxGrp -edit -enable false createPolyConePreserveAspectRatioCheckBox; } }else { checkBoxGrp -edit -enable false createPolyConeNormalizeCheckBox; checkBoxGrp -edit -enable false createPolyConePreserveAspectRatioCheckBox; } if($createUVVal && $normalizeVal && $preserveARVal){ $value = 3; } else if ($createUVVal && $normalizeVal){ $value = 2; } else if ($createUVVal){ $value = 1; } string $cmd = ("createPolyConeCtx -edit -cuv " + $value + " " + $toolName); eval($cmd); }