// =========================================================================== // 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 int $showRotateManipPivotWarning = 1; global proc manipRotateValues ( string $toolName ) { global int $showRotateManipPivotWarning; string $parent = (`toolPropertyWindow -q -location` + "|manipRotate"); setParent $parent; // Initialize settings // string $axisLabel = ""; int $manipMode = `manipRotateContext -q -mode $toolName`; switch ($manipMode) { case 0: $axisLabel = `uiRes("m_manipMoveProperties.kObject")`; break; case 1: $axisLabel = `uiRes("m_manipMoveProperties.kWorld")`; break; case 2: $axisLabel = `uiRes("m_manipRotateProperties.kGimbal")`; break; case 3: $axisLabel = `uiRes("m_manipMoveProperties.kCustomAxisOrientation")`; break; case 9: case 10: $axisLabel = `uiRes("m_manipMoveProperties.kAutoAlign")`; break; } textField -e -tx $axisLabel axisOrientField; float $ori[] = `manipRotateContext -q -orientAxes $toolName`; floatField -e -v (rad_to_deg($ori[0])) manipRotateOrientFieldX; floatField -e -v (rad_to_deg($ori[1])) manipRotateOrientFieldY; floatField -e -v (rad_to_deg($ori[2])) manipRotateOrientFieldZ; // edit pivot int $editMode = `manipRotateContext -q -editPivotMode $toolName`; if ($editMode) { iconTextButton -e -bgc 0.322 0.52 0.65 -c "ctxEditMode" editPivotButton; // use our unified Maya highligh color #5285A6 } else { iconTextButton -e -bgc 0.37 0.37 0.37 -c "ctxEditMode" editPivotButton; // off the background and then turn it on to reset it iconTextButton -e -nbg 1 editPivotButton; iconTextButton -e -nbg 0 editPivotButton; } iconTextButton -e -c ("{ string $objs[] = `ls -sl -type transform -type geometryShape`;" + "if (size($objs) > 0) { xform -cp; } manipPivot -rp -ro; }") resetPivotButton; int $pivotMode = 1; if( `manipRotateContext -q -useCenterPivot $toolName` ) { $pivotMode = 4; } else if( `manipRotateContext -q -useManipPivot $toolName`) { $pivotMode = 3; if( $showRotateManipPivotWarning ) { warning (uiRes("m_manipRotateValues.kManipPivotNotForAnimation")); $showRotateManipPivotWarning = 0; } } else if( `manipRotateContext -q -useObjectPivot $toolName`) { $pivotMode = 2; } radioButtonGrp -e -nrb 4 -on1 ("manipRotateContext -e -useManipPivot 0 -useObjectPivot 0 -useCenterPivot 0 " + $toolName) -on2 ("manipRotateContext -e -useManipPivot 0 -useObjectPivot 1 -useCenterPivot 0 " + $toolName) -on3 ("manipRotateContext -e -useManipPivot 1 -useObjectPivot 0 -useCenterPivot 0 " + $toolName) -on4 ("manipRotateContext -e -useManipPivot 0 -useObjectPivot 0 -useCenterPivot 1 " + $toolName) -select $pivotMode manipPivotRadio; reflectionValues( ); softSelectValues( $parent ); commonSelectValues( $parent ); smartDupValues( $parent ); int $trackball = `manipRotateContext -q -ctb $toolName`; checkBoxGrp -e -v1 $trackball manipCenterTrackball; checkBoxGrp -e -cc1 ("manipRotateContext -e -centerTrackball #1 " + $toolName) manipCenterTrackball; string $label = ""; int $snapMode = manipRotateGetSnapMode(); switch ($snapMode) { default: case 0: $label = `uiRes("m_manipMoveProperties.kOff")`; break; case 1: $label = `uiRes("m_manipMoveProperties.kRelative")`; break; case 2: $label = `uiRes("m_manipMoveProperties.kAbsolute")`; break; } textField -e -tx $label manipRotateSnapModeLabel; floatField -e -en ($snapMode != 0) -v (`manipRotateContext -q -snapValue Rotate`) manipRotateSnapValue; int $pcp = `manipRotateContext -q -preserveChildPosition $toolName`; int $puv = `manipRotateContext -q -preserveUV $toolName`; int $mt = `manipRotateContext -q -modifyTranslation $toolName`; checkBoxGrp -e -v1 $pcp rotatePreserveChildCheckBx; checkBoxGrp -e -v1 $puv rotatePreserveUVCheckBx; checkBoxGrp -e -v1 $mt rotateModifyTranslationCheckBx; checkBoxGrp -e -cc1 ("setTRSPreserveChildPosition #1") rotatePreserveChildCheckBx; checkBoxGrp -e -cc1 ("setTRSPreserveUVs #1") rotatePreserveUVCheckBx; int $pin = `manipRotateContext -q -pinPivot $toolName`; checkBoxGrp -e -v1 $pin pinComponentPivotCheckBx; int $oriHandle = `optionVar -q manipShowPivotRotateHandle`; checkBoxGrp -e -v1 $oriHandle pivotOriHandleCheckBx; int $snapPos = `manipRotateContext -q -snapPivotPos $toolName`; int $snapOri = `manipRotateContext -q -snapPivotOri $toolName`; checkBoxGrp -e -v1 $snapPos snapPivotPosCheckBx; checkBoxGrp -e -v1 $snapOri snapPivotOriCheckBx; string $xformCns = `xformConstraint -q -type -live`; if ($xformCns == "live") { textField -e -en 0 -tx `uiRes("m_manipMoveValues.kManipMoveXformConstraintLive")` manipRotateXformConstraintModeLabel; iconTextButton -e -en 0 manipRotateXformConstraintButton; } else { string $label = ""; if ($xformCns == "edge") $label = `uiRes("m_manipMoveProperties.kManipMoveXformConstraintEdge")`; else if ($xformCns == "surface") $label = `uiRes("m_manipMoveProperties.kManipMoveXformConstraintSurf")`; else $label = `uiRes("m_manipMoveProperties.kManipMoveXformConstraintNone")`; textField -e -en 1 -tx $label manipRotateXformConstraintModeLabel; iconTextButton -e -en 1 manipRotateXformConstraintButton; } int $xformCnsAlongNormal = `xformConstraint -q -alongNormal`; radioButtonGrp -e -sl ($xformCnsAlongNormal ? 1 : 2) manipRotateXformConstraintAlongNormalRadioBtn; int $tweakMode = `manipRotateContext -q -tweakMode $toolName`; checkBoxGrp -e -cc ("strsTweakMode #1") -v1 $tweakMode tweakModeCheckBox; checkBoxGrp -e -cc1 ("manipRotateContext -e -modifyTranslation #1 " + $toolName) rotateModifyTranslationCheckBx; string $helpTag = "RotateTool"; toolPropertySetCommon $toolName "rotate_M.png" $helpTag; toolPropertySelect "manipRotate"; string $reset = `toolPropertyWindow -query -resetButton`; string $cmd = `button -q -command $reset`; $cmd += ";smartDupReset;"; button -edit -command $cmd $reset; }