// =========================================================================== // 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 createPolyPyramidValues(string $toolName) { string $name = "createPolyPyramid"; string $parent = (`toolPropertyWindow -q -location` + "|" + $name); setParent $parent; int $hDiv = `createPolyPyramidCtx -q -sh $toolName`; int $dDiv = `createPolyPyramidCtx -q -sd $toolName`; float $sl = `createPolyPyramidCtx -q -sideLength $toolName`; int $numSides = `createPolyPyramidCtx -q -numberOfSides $toolName`; int $uvSetting = `createPolyPyramidCtx -q -createUVs $toolName`; int $createUV = 0; int $normalize = 0; int $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 = `createPolyPyramidCtx -q -axis $toolName`; int $dragEdit = `createPolyPyramidCtx -q -doDragEdit $toolName`; int $dragEditCaps = `createPolyPyramidCtx -q -doSubdivisionsCapsEdit $toolName`; intSliderGrp -e -v $hDiv -cc ("createPolyPyramidCtx -e -sh #1 " + $toolName) createPolyPyramidHeightDivisionsSlider; intSliderGrp -e -v $dDiv -cc ("createPolyPyramidCtx -e -sd #1 " + $toolName) createPolyPyramidDepthDivisionsSlider; floatSliderGrp -e -v $sl -cc ("createPolyPyramidCtx -e -sideLength #1 " + $toolName) createPolyPyramidSideLengthSlider; radioButtonGrp -e -sl ($axis + 1) -cc ("changePyramidAxisSetting(\"" + $toolName+ "\")") createPolyPyramidAxisRadioButton; checkBoxGrp -e -v1 $createUV -cc1 ("changePyramidUVSettings(\"" + $toolName+ "\")") createPolyPyramidCreateUVCheckBox; checkBoxGrp -e -v1 $normalize -cc1 ("changePyramidUVSettings(\"" + $toolName+ "\")") createPolyPyramidNormalizeCheckBox; checkBoxGrp -e -v1 $preserveAR -cc1 ("changePyramidUVSettings(\"" + $toolName+ "\")") createPolyPyramidPreserveAspectRatioCheckBox; checkBoxGrp -e -v1 $dragEdit -cc1 ("createPolyPyramidCtx -e -doDragEdit " + !$dragEdit + " " + $toolName) createPolyPyramidDragEditCheckBox; int $doDrag = `checkBoxGrp -q -v1 createPolyPyramidDragEditCheckBox`; if ($doDrag) checkBoxGrp -edit -enable true createPolyPyramidCapsDragEditCheckBox; else checkBoxGrp -edit -enable false createPolyPyramidCapsDragEditCheckBox; checkBoxGrp -e -v1 $dragEditCaps -cc1 ("createPolyPyramidCtx -e -doSubdivisionsCapsEdit " + !$dragEditCaps + " " + $toolName) createPolyPyramidCapsDragEditCheckBox; // we select ($numSides-2) because the number of sides of a pyramid // start at 3, and the selection index is 1 based. radioButtonGrp -e -select ($numSides - 2) -onCommand1 ("createPolyPyramidCtx -e -numberOfSides 3 " + $toolName) -onCommand2 ("createPolyPyramidCtx -e -numberOfSides 4 " + $toolName) -onCommand3 ("createPolyPyramidCtx -e -numberOfSides 5 " + $toolName) createPolyPyramidNumberOfSidesRadioButtonGrp; string $icon = "polyPyramid.png"; string $helpTag= "CreatePolyPyramidTool"; toolPropertySetCommon $toolName $icon $helpTag; toolPropertySelect $name; changePyramidUVSettings($toolName); } global proc changePyramidAxisSetting(string $toolName){ int $axisSetting = 0; if (`radioButtonGrp -exists createPolyPyramidAxisRadioButton`){ $axisSetting = (`radioButtonGrp -q -sl createPolyPyramidAxisRadioButton` - 1); } if ($axisSetting < 0){ $axisSetting = 0; } string $cmd = "createPolyPyramidCtx -e -axis " + $axisSetting + " " + $toolName; eval($cmd); } global proc changePyramidUVSettings(string $toolName) { int $value = 0; int $createUVVal; int $normalizeVal; int $preserveARVal; if (`checkBoxGrp -exists createPolyPyramidCreateUVCheckBox`){ $createUVVal = `checkBoxGrp -q -v1 createPolyPyramidCreateUVCheckBox`; } if (`checkBoxGrp -exists createPolyPyramidNormalizeCheckBox`){ $normalizeVal = `checkBoxGrp -q -v1 createPolyPyramidNormalizeCheckBox`; } if (`checkBoxGrp -exists createPolyPyramidPreserveAspectRatioCheckBox`){ $preserveARVal = `checkBoxGrp -q -v1 createPolyPyramidPreserveAspectRatioCheckBox`; } if (!$createUVVal){ checkBoxGrp -edit -enable false createPolyPyramidNormalizeCheckBox; checkBoxGrp -edit -enable false createPolyPyramidPreserveAspectRatioCheckBox; }else { checkBoxGrp -edit -enable true createPolyPyramidNormalizeCheckBox; if (!$normalizeVal){ checkBoxGrp -edit -enable false createPolyPyramidPreserveAspectRatioCheckBox; }else { checkBoxGrp -edit -enable true createPolyPyramidPreserveAspectRatioCheckBox; } } if($createUVVal && $normalizeVal && $preserveARVal){ $value = 3; } else if ($createUVVal && $normalizeVal){ $value = 2; } else if ($createUVVal){ $value = 1; } string $cmd = ("createPolyPyramidCtx -edit -cuv " + $value + " " + $toolName); eval($cmd); }