// =========================================================================== // 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 $showScaleManipPivotWarning = 1; global proc manipScaleValues ( string $toolName ) { global int $showScaleManipPivotWarning; string $parent = (`toolPropertyWindow -q -location` + "|manipScale"); setParent $parent; // Initialize settings // string $axisLabel = ""; int $manipMode = `manipScaleContext -q -mode $toolName`; switch ($manipMode) { case 0: $axisLabel = `uiRes("m_manipMoveProperties.kObject")`; break; case 1: $axisLabel = `uiRes("m_manipMoveProperties.kLocal")`; break; case 2: $axisLabel = `uiRes("m_manipMoveProperties.kWorld")`; break; case 3: $axisLabel = `uiRes("m_manipMoveProperties.kNormal")`; break; case 4: $axisLabel = `uiRes("m_manipMoveProperties.kAlongRotationAxis")`; break; case 5: $axisLabel = `uiRes("m_manipMoveProperties.kAlongLiveObjectAxis")`; break; case 6: $axisLabel = `uiRes("m_manipMoveProperties.kCustomAxisOrientation")`; break; case 9: case 10: $axisLabel = `uiRes("m_manipMoveProperties.kAutoAlign")`; break; } textField -e -tx $axisLabel axisOrientField; float $ori[] = `manipScaleContext -q -orientAxes $toolName`; floatField -e -v (rad_to_deg($ori[0])) manipScaleOrientFieldX; floatField -e -v (rad_to_deg($ori[1])) manipScaleOrientFieldY; floatField -e -v (rad_to_deg($ori[2])) manipScaleOrientFieldZ; // edit pivot int $editMode = `manipScaleContext -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( `manipScaleContext -q -useManipPivot $toolName`) { if( $showScaleManipPivotWarning ) { warning (uiRes("m_manipScaleValues.kManipPivotNotForAnimation")); $showScaleManipPivotWarning = 0; } $pivotMode = 3; } else if( `manipScaleContext -q -useObjectPivot $toolName`) { $pivotMode = 2; } radioButtonGrp -e -nrb 3 -on1 ("manipScaleContext -e -useManipPivot 0 -useObjectPivot 0 " + $toolName) -on2 ("manipScaleContext -e -useManipPivot 0 -useObjectPivot 1 " + $toolName) -on3 ("manipScaleContext -e -useManipPivot 1 -useObjectPivot 0 " + $toolName) -select $pivotMode manipPivotRadio; reflectionValues( ); softSelectValues( $parent ); commonSelectValues( $parent ); smartDupValues( $parent ); string $label = ""; int $snapMode = manipScaleGetSnapMode(); 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 manipScaleSnapModeLabel; floatField -e -en ($snapMode != 0) -v (`manipScaleContext -q -snapValue Scale`) manipScaleSnapValue; int $pcp = `manipScaleContext -q -preserveChildPosition $toolName`; int $puv = `manipScaleContext -q -preserveUV $toolName`; checkBoxGrp -e -v1 $pcp scalePreserveChildCheckBx; checkBoxGrp -e -v1 $puv scalePreserveUVCheckBx; checkBoxGrp -e -cc1 ("setTRSPreserveChildPosition #1") scalePreserveChildCheckBx; checkBoxGrp -e -cc1 ("setTRSPreserveUVs #1") scalePreserveUVCheckBx; int $pin = `manipScaleContext -q -pinPivot $toolName`; checkBoxGrp -e -v1 $pin pinComponentPivotCheckBx; int $oriHandle = `optionVar -q manipShowPivotRotateHandle`; checkBoxGrp -e -v1 $oriHandle pivotOriHandleCheckBx; int $snapPos = `manipScaleContext -q -snapPivotPos $toolName`; int $snapOri = `manipScaleContext -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")` manipScaleXformConstraintModeLabel; iconTextButton -e -en 0 manipScaleXformConstraintButton; } 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 manipScaleXformConstraintModeLabel; iconTextButton -e -en 1 manipScaleXformConstraintButton; } int $xformCnsAlongNormal = `xformConstraint -q -alongNormal`; radioButtonGrp -e -sl ($xformCnsAlongNormal ? 1 : 2) manipScaleXformConstraintAlongNormalRadioBtn; int $tweakMode = `manipScaleContext -q -tweakMode $toolName`; checkBoxGrp -e -cc ("strsTweakMode #1") -v1 $tweakMode tweakModeCheckBox; int $prev = `manipScaleContext -q -preventNegativeScale $toolName`; checkBoxGrp -e -v1 $prev preventNegativeScale; checkBoxGrp -e -cc1 ("manipScaleContext -edit -preventNegativeScale #1 Scale") preventNegativeScale; string $helpTag = "ScaleTool"; toolPropertySetCommon $toolName "scale_M.png" $helpTag; toolPropertySelect "manipScale"; string $reset = `toolPropertyWindow -query -resetButton`; string $cmd = `button -q -command $reset`; $cmd += ";smartDupReset;"; button -edit -command $cmd $reset; }