// =========================================================================== // 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 showManipValues ( string $toolName ) { string $parent = (`toolPropertyWindow -q -location` + "|showManip"); setParent $parent; int $isSnapTranslate = false; int $isSnapRotate = false; int $isSnapScale = false; int $isTranslateRelative = false; int $isRotateRelative = false; int $isScaleRelative = false; int $ui[] = `showManipCtx -query -incSnapUI showManip3D`; // Figure out what UI to display int $showTranslate = false; int $showRotate = false; int $showScale = false; int $count = size($ui); int $index; for($index = 0; $index < $count; $index++) { int $currentElement = $ui[$index]; if($currentElement == 1) { $showTranslate = true; } else if($currentElement == 2) { $showRotate = true; } else if($currentElement == 3) { $showScale = true; } } int $snap[] = `showManipCtx -query -incSnap showManip3D`; $count = size($snap); for($index = 0; $index < $count; $index++) { int $currentElement = $snap[$index]; if($currentElement == 1) { $isSnapTranslate = true; } else if($currentElement == 2) { $isSnapRotate = true; } else if($currentElement == 3) { $isSnapScale = true; } } int $rel[] = `showManipCtx -query -incSnapRelative showManip3D`; $count = size($rel); for($index = 0; $index < $count; $index++) { int $currentElement = $rel[$index]; if($currentElement == 1) { $isTranslateRelative = true; } else if($currentElement == 2) { $isRotateRelative = true; } else if($currentElement == 3) { $isScaleRelative = true; } } float $snapVal[] = `showManipCtx -query -incSnapValue showManip3D`; // Incremental linear translate if($showTranslate) { frameLayout -e -vis on showManipMoveFrame; checkBoxGrp -e -v1 $isSnapTranslate showManipMoveSnapCheck; checkBoxGrp -e -enable $isSnapTranslate -v1 $isTranslateRelative showManipMoveSnapRelative; floatFieldGrp -e -enable $isSnapTranslate -v1 $snapVal[0] showManipMoveSnapValue; checkBoxGrp -e -cc1 ("showManipCtx -e -incSnap 1 #1 showManip3D") showManipMoveSnapCheck; checkBoxGrp -e -cc1 ("showManipCtx -e -incSnapRelative 1 #1 showManip3D") showManipMoveSnapRelative; floatFieldGrp -e -cc ("showManipCtx -e -incSnapValue 1 #1 showManip3D") showManipMoveSnapValue; } else { frameLayout -e -vis off showManipMoveFrame; } // Rotate tool if($showRotate) { frameLayout -e -vis on showManipRotateFrame; checkBoxGrp -e -v1 $isSnapRotate showManipRotateSnapCheck; checkBoxGrp -e -enable $isSnapRotate -v1 $isRotateRelative showManipRotateSnapRelative; floatFieldGrp -e -enable $isSnapRotate -v1 $snapVal[1] showManipRotateSnapValue; checkBoxGrp -e -cc1 ("showManipCtx -e -incSnap 2 #1 showManip3D") showManipRotateSnapCheck; checkBoxGrp -e -cc1 ("showManipCtx -e -incSnapRelative 2 #1 showManip3D") showManipRotateSnapRelative; floatFieldGrp -e -cc ("showManipCtx -e -incSnapValue 2 #1 showManip3D") showManipRotateSnapValue; } else { frameLayout -e -vis off showManipRotateFrame; } // Scale tool if($showScale) { frameLayout -e -vis on showManipScaleFrame; checkBoxGrp -e -v1 $isSnapScale showManipScaleSnapCheck; checkBoxGrp -e -enable $isSnapScale -v1 $isScaleRelative showManipScaleSnapRelative; floatFieldGrp -e -enable $isSnapScale -v1 $snapVal[2] showManipScaleSnapValue; checkBoxGrp -e -cc1 ("showManipCtx -e -incSnap 3 #1 showManip3D") showManipScaleSnapCheck; checkBoxGrp -e -cc1 ("showManipCtx -e -incSnapRelative 3 #1 showManip3D") showManipScaleSnapRelative; floatFieldGrp -e -cc ("showManipCtx -e -incSnapValue 3 #1 showManip3D") showManipScaleSnapValue; } else { frameLayout -e -vis off showManipScaleFrame; } string $icon = "showManip.png"; string $helpTag = "showManipTool"; toolPropertySetCommon $toolName $icon $helpTag; toolPropertySelect "showManip"; }