// =========================================================================== // 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 createPolyCubeValues(string $toolName) { string $name = "createPolyCube"; string $parent = (`toolPropertyWindow -q -location` + "|" + $name); setParent $parent; int $wDiv = `createPolyCubeCtx -q -sw $toolName`; int $hDiv = `createPolyCubeCtx -q -sh $toolName`; int $dDiv = `createPolyCubeCtx -q -sd $toolName`; float $w = `createPolyCubeCtx -q -width $toolName`; float $d = `createPolyCubeCtx -q -depth $toolName`; float $h = `createPolyCubeCtx -q -height $toolName`; int $uvSetting = `createPolyCubeCtx -q -createUVs $toolName`; int $createUV = 0; int $normalize = 0; int $preserveAR = 0; int $collective = 0; int $seperate = 0; int $select = 1; if ($uvSetting == 4){ $createUV = 1; $normalize = 1; $collective = 1; $preserveAR = 1; $select = 1; } else if ($uvSetting == 3){ $createUV = 1; $normalize = 1; $collective = 1; $select = 1; } else if ($uvSetting == 2){ $createUV = 1; $normalize = 1; $seperate = 1; $select = 2; } else if ($uvSetting == 1){ $createUV = 1; } int $axis = `createPolyCubeCtx -q -axis $toolName`; int $dragEdit = `createPolyCubeCtx -q -doDragEdit $toolName`; intSliderGrp -e -v $wDiv -cc ("createPolyCubeCtx -e -sw #1 " + $toolName) createPolyCubeWidthDivisionsSlider; intSliderGrp -e -v $hDiv -cc ("createPolyCubeCtx -e -sh #1 " + $toolName) createPolyCubeHeightDivisionsSlider; intSliderGrp -e -v $dDiv -cc ("createPolyCubeCtx -e -sd #1 " + $toolName) createPolyCubeDepthDivisionsSlider; floatSliderGrp -e -v $w -cc ("createPolyCubeCtx -e -width #1 " + $toolName) createPolyCubeWidthSlider; floatSliderGrp -e -v $d -cc ("createPolyCubeCtx -e -depth #1 " + $toolName) createPolyCubeDepthSlider; floatSliderGrp -e -v $h -cc ("createPolyCubeCtx -e -height #1 " + $toolName) createPolyCubeHeightSlider; radioButtonGrp -e -sl ($axis + 1) -cc ("changeCubeAxisSetting(\"" + $toolName+ "\")") createPolyCubeAxisRadioButton; checkBoxGrp -e -v1 $createUV -cc1 ("changeCubeUVSettings(\"" + $toolName+ "\")") createPolyCubeCreateUVCheckBox; checkBoxGrp -e -v1 $normalize -cc1 ("changeCubeUVSettings(\"" + $toolName+ "\")") createPolyCubeNormalizeCheckBox; radioButtonGrp -e -sl $select -cc ("changeCubeUVSettings(\"" + $toolName+ "\")") createPolyCubeNormalizeTypeRadioButton; checkBoxGrp -e -v1 $preserveAR -cc1 ("changeCubeUVSettings(\"" + $toolName+ "\")") createPolyCubePreserveAspectRatioCheckBox; checkBoxGrp -e -v1 $dragEdit -cc1 ("createPolyCubeCtx -e -doDragEdit " + !$dragEdit + " " + $toolName) createPolyCubeDragEditCheckBox; string $icon = "polyCube.png"; string $helpTag= "CreatePolyCubeTool"; toolPropertySetCommon $toolName $icon $helpTag; toolPropertySelect $name; changeCubeUVSettings($toolName); } global proc changeCubeAxisSetting(string $toolName){ int $axisSetting = 0; if (`radioButtonGrp -exists createPolyCubeAxisRadioButton`){ $axisSetting = (`radioButtonGrp -q -sl createPolyCubeAxisRadioButton` - 1); } if ($axisSetting < 0){ $axisSetting = 0; } string $cmd = "createPolyCubeCtx -e -axis " + $axisSetting + " " + $toolName; eval($cmd); } global proc changeCubeUVSettings(string $toolName) { int $value = 0; int $createUVVal; int $normalizeVal; int $preserveARVal; int $collectiveVal; int $seperateVal; if (`checkBoxGrp -exists createPolyCubeCreateUVCheckBox`){ $createUVVal = `checkBoxGrp -q -v1 createPolyCubeCreateUVCheckBox`; } if (`checkBoxGrp -exists createPolyCubeNormalizeCheckBox`){ $normalizeVal = `checkBoxGrp -q -v1 createPolyCubeNormalizeCheckBox`; } if (`checkBoxGrp -exists createPolyCubePreserveAspectRatioCheckBox`){ $preserveARVal = `checkBoxGrp -q -v1 createPolyCubePreserveAspectRatioCheckBox`; } if (`radioButtonGrp -exists createPolyCubeNormalizeTypeRadioButton`){ $collectiveVal = `radioButtonGrp -q -sl createPolyCubeNormalizeTypeRadioButton`; $seperateVal = `radioButtonGrp -q -sl createPolyCubeNormalizeTypeRadioButton`; } if ($collectiveVal == 1){ $collectiveVal = 1; } else { $collectiveVal = 0; } if ($seperateVal == 2){ $seperateVal = 1; } else { $seperateVal = 0; } if ($createUVVal){ checkBoxGrp -edit -enable true createPolyCubeNormalizeCheckBox; if ($normalizeVal){ radioButtonGrp -edit -enable true createPolyCubeNormalizeTypeRadioButton; if($collectiveVal){ checkBoxGrp -edit -enable true createPolyCubePreserveAspectRatioCheckBox; } else { checkBoxGrp -edit -enable false createPolyCubePreserveAspectRatioCheckBox; } }else { checkBoxGrp -edit -enable false createPolyCubePreserveAspectRatioCheckBox; radioButtonGrp -edit -enable false createPolyCubeNormalizeTypeRadioButton; } }else { checkBoxGrp -edit -enable false createPolyCubeNormalizeCheckBox; checkBoxGrp -edit -enable false createPolyCubePreserveAspectRatioCheckBox; radioButtonGrp -edit -enable false createPolyCubeNormalizeTypeRadioButton; } if($createUVVal && $normalizeVal && $collectiveVal && $preserveARVal){ $value = 4; } else if($createUVVal && $normalizeVal && $collectiveVal){ $value = 3; } else if ($createUVVal && $normalizeVal){ $value = 2; } else if ($createUVVal){ $value = 1; } string $cmd = ("createPolyCubeCtx -edit -cuv " + $value + " " + $toolName); eval($cmd); }