// =========================================================================== // 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 manipRotateBuildOrientMenu(string $menu) { menu -e -dai $menu; menuItem -label `uiRes("m_manipMoveProperties.kMoveSetOriToObject")` -p $menu -c "manipRotateOrient 5"; menuItem -label `uiRes("m_manipMoveProperties.kMoveSetOriToComponent")` -p $menu -c "manipRotateOrient 4"; menuItem -label `uiRes("m_manipMoveProperties.kMoveSetOriToVertex")` -p $menu -c "manipRotateOrient 1"; menuItem -label `uiRes("m_manipMoveProperties.kMoveSetOriToEdge")` -p $menu -c "manipRotateOrient 2"; menuItem -label `uiRes("m_manipMoveProperties.kMoveSetOriToFace")` -p $menu -c "manipRotateOrient 3"; menuItem -label `uiRes("m_manipMoveProperties.kMoveResetOri")` -p $menu -c "manipRotateOrient 0"; } global proc manipRotateBuildAxisMenu(string $menu) { menu -e -dai $menu; menuItem -label `uiRes("m_manipMoveProperties.kObject")` -p $menu -c "manipRotateContext -e -mode 0 $currManipRotatePropertiesCtx"; menuItem -label `uiRes("m_manipMoveProperties.kWorld")` -p $menu -c "manipRotateContext -e -mode 1 $currManipRotatePropertiesCtx"; menuItem -label `uiRes("m_manipMoveProperties.kAutoAlign")` -p $menu -c "manipRotateContext -e -mode 10 $currManipRotatePropertiesCtx"; menuItem -label (uiRes("m_manipRotateProperties.kGimbal")) -p $menu -c "manipRotateContext -e -mode 2 $currManipRotatePropertiesCtx"; menuItem -label `uiRes("m_manipMoveProperties.kCustomAxisOrientation")` -p $menu -c "manipRotateContext -e -mode 3 $currManipRotatePropertiesCtx"; } global proc int manipRotateGetSnapMode() { global string $currManipRotatePropertiesCtx; int $enabled = `manipRotateContext -q -snap $currManipRotatePropertiesCtx`; int $relative = $enabled && `manipRotateContext -q -snapRelative $currManipRotatePropertiesCtx`; return !$enabled ? /*off*/0 : $relative ? /*relative*/1 : /*absolute*/2; } global proc manipRotateSetSnapMode(int $mode) { global string $currManipRotatePropertiesCtx; global int $manipRotatePrevSnapMode; if ($mode != 0) $manipRotatePrevSnapMode = $mode; switch ($mode) { default: case 0: manipRotateContext -e -snap 0 $currManipRotatePropertiesCtx; break; case 1: manipRotateContext -e -snap 1 -snapRelative 1 $currManipRotatePropertiesCtx; break; case 2: manipRotateContext -e -snap 1 -snapRelative 0 $currManipRotatePropertiesCtx; break; } } global proc manipRotateToggleSnapMode() { int $mode = manipRotateGetSnapMode(); global int $manipRotatePrevSnapMode; manipRotateSetSnapMode($mode == 0 ? $manipRotatePrevSnapMode : 0); } global proc manipRotateBuildSnapMenu(string $menu) { menu -e -dai $menu; menuItem -label (uiRes("m_manipMoveProperties.kOff")) -p $menu -c "manipRotateSetSnapMode 0"; menuItem -label (uiRes("m_manipMoveProperties.kRelative")) -p $menu -c "manipRotateSetSnapMode 1"; menuItem -label (uiRes("m_manipMoveProperties.kAbsolute")) -p $menu -c "manipRotateSetSnapMode 2"; } global proc manipRotateSetXformConstraint(string $mode) { global string $manipRotatePrevXformConstraint; if ($mode != "none") $manipRotatePrevXformConstraint = $mode; setXformConstraint $mode; } global proc manipRotateToggleXformConstraint() { global string $manipRotatePrevXformConstraint; string $mode = `xformConstraint -q -type`; manipRotateSetXformConstraint($mode == "none" ? $manipRotatePrevXformConstraint : "none"); } global proc manipRotateBuildXformConstraintMenu(string $menu) { menu -e -dai $menu; menuItem -label (uiRes("m_manipMoveProperties.kManipMoveXformConstraintNone")) -p $menu -c "manipRotateSetXformConstraint none"; menuItem -label (uiRes("m_manipMoveProperties.kManipMoveXformConstraintEdge")) -p $menu -c "manipRotateSetXformConstraint edge"; menuItem -label (uiRes("m_manipMoveProperties.kManipMoveXformConstraintSurf")) -p $menu -c "manipRotateSetXformConstraint surface"; } global proc rotateOrientAxesChanged(int $i, float $value) { global string $currManipRotatePropertiesCtx; float $ori[] = `manipRotateContext -q -orientAxes $currManipRotatePropertiesCtx`; $ori[$i] = deg_to_rad($value); manipRotateContext -e -mode 3 -orientAxes $ori[0] $ori[1] $ori[2] $currManipRotatePropertiesCtx; } global proc manipRotateProperties () { global int $manipRotatePrevSnapMode = 1; global string $manipRotatePrevXformConstraint = "surface"; // Linux Motif2.1 shrinks the checkBox, if the string is "" // NT would tab over the blank (" ") string label. // So... string $emptyLabel = ""; if (`about -linux`) { $emptyLabel = " "; } string $parent = `toolPropertyWindow -q -location`; setUITemplate -pushTemplate OptionsTemplate; setParent $parent; // Define manip rotate context associated with the current tool. This is // used by callbacks to execute rotate commands. (MAYA-63108) string $curContext = `currentCtx`; global string $currManipRotatePropertiesCtx; $currManipRotatePropertiesCtx = (`superCtx -ex $curContext` ? `superCtx -q $curContext` : $curContext); if ("" == $currManipRotatePropertiesCtx) $currManipRotatePropertiesCtx = "Rotate"; columnLayout -adj true manipRotate; frameLayout -collapsable true -collapse false -label (uiRes("m_manipRotateProperties.kRotateSettings")) manipRotateFrame; columnLayout manipRotateOptions; separator -style "none"; rowLayout -nc 3 -cw3 132 20 190; text -l `uiRes("m_manipMoveProperties.kMove")` -align right axisOrientationLabel; string $axisButton = `iconTextButton -w 17 -h 26 -image ("popupMenuIcon.png") axisOrientMenuButton`; string $axisMenu = `popupMenu -b 1 -p $axisButton`; menu -e -pmc ("manipRotateBuildAxisMenu " + $axisMenu) $axisMenu; string $axisMenu2 = `popupMenu -b 2 -p $axisButton`; menu -e -pmc "manipRotateContext -e -mode `manipRotateContext -q -lastMode $currManipRotatePropertiesCtx` $currManipRotatePropertiesCtx" $axisMenu2; textField -ed false -width 190 -height 25 -ann `uiRes("m_manipMoveProperties.kCustomAxisOrientationAnn")` axisOrientField; setParent ..; rowLayout -nc 5 -cw5 132 20 62 62 62; text -l $emptyLabel -align right moveOrientLabel; string $orientButton = `iconTextButton -w 17 -h 26 -image ("popupMenuIcon.png") rotateOrientMenuButton`; string $menu = `popupMenu -b 1 -p $orientButton`; menu -e -pmc ("manipRotateBuildOrientMenu " + $menu) $menu; string $menu2 = `popupMenu -b 2 -p $orientButton`; menu -e -pmc "manipRotateOrient -1" $menu2; floatField -w 62 -ann `uiRes("m_manipMoveProperties.kCustomAxisOrientFieldsAnn")` -cc "rotateOrientAxesChanged 0 #1" manipRotateOrientFieldX; floatField -w 62 -ann `uiRes("m_manipMoveProperties.kCustomAxisOrientFieldsAnn")` -cc "rotateOrientAxesChanged 1 #1" manipRotateOrientFieldY; floatField -w 62 -ann `uiRes("m_manipMoveProperties.kCustomAxisOrientFieldsAnn")` -cc "rotateOrientAxesChanged 2 #1" manipRotateOrientFieldZ; setParent ..; separator -style "none"; rowLayout -nc 3 -cw3 132 100 50; text -l `uiRes("m_manipMoveProperties.kPivotLabel")` -align right editPivotLabel; iconTextButton -st "textOnly" -l `uiRes("m_manipMoveProperties.kEditPivot")` -ann `uiRes("m_manipMoveProperties.kEditPivotAnn")` -flat 0 -w 100 -h 23 editPivotButton; iconTextButton -st "textOnly" -l `uiRes("m_manipMoveProperties.kResetPivot")` -ann `uiRes("m_manipMoveProperties.kResetPivotAnn")` -flat 0 -w 50 -h 23 resetPivotButton; setParent ..; checkBoxGrp -ncb 1 -label $emptyLabel -label1 `uiRes("m_manipMoveProperties.kSnapPivotPos")` -cc ("setTRSSnapPivotPos #1") -ann `uiRes("m_manipMoveProperties.kSnapPivotPosAnn")` snapPivotPosCheckBx; checkBoxGrp -ncb 1 -label $emptyLabel -label1 `uiRes("m_manipMoveProperties.kSnapPivotOri")` -cc1 ("setTRSSnapPivotOri #1") -ann `uiRes("m_manipMoveProperties.kSnapPivotOriAnn")` snapPivotOriCheckBx; checkBoxGrp -ncb 1 -label $emptyLabel -label1 `uiRes("m_manipMoveProperties.kPinComponentPivot")` -cc1 ("setTRSPinPivot #1") -ann `uiRes("m_manipMoveProperties.kPinComponentPivotAnn")` pinComponentPivotCheckBx; checkBoxGrp -ncb 1 -label $emptyLabel -label1 `uiRes("m_manipMoveProperties.kPivotOriHandle")` -cc1 ("setTRSPivotOriHandle #1") -ann `uiRes("m_manipMoveProperties.kPivotOriHandleAnn")` pivotOriHandleCheckBx; radioButtonGrp -nrb 4 -label (uiRes("m_manipRotateProperties.kRotatePivot")) -label1 (uiRes("m_manipRotateProperties.kDefaultPivot")) -label2 (uiRes("m_manipRotateProperties.kObjectPivot")) -label3 (uiRes("m_manipRotateProperties.kManipPivot")) -label4 (uiRes("m_manipRotateProperties.kCenterPivot")) -ann (uiRes("m_manipRotateProperties.kRotatePivotAnn")) manipPivotRadio; checkBoxGrp -ncb 1 -label $emptyLabel -label1 (uiRes("m_manipRotateProperties.kModifyTranslation")) -ann (uiRes("m_manipRotateProperties.kModifyTranslationAnn")) rotateModifyTranslationCheckBx; separator; rowLayout -nc 3 -cw3 132 20 131; text -align right -l (uiRes("m_manipMoveProperties.kManipMoveXformConstraint")) -ann (uiRes("m_manipMoveProperties.kManipMoveXformConstraintAnn")) manipRotateXformConstraintLabel; string $constraintButton = `iconTextButton -w 17 -h 26 -image ("popupMenuIcon.png") -ann (uiRes("m_manipMoveProperties.kManipMoveXformConstraintAnn")) manipRotateXformConstraintButton`; string $constraintMenu = `popupMenu -b 1 -p $constraintButton`; menu -e -pmc ("manipRotateBuildXformConstraintMenu " + $constraintMenu) $constraintMenu; string $constraintToggle = `popupMenu -b 2 -p $constraintButton`; menu -e -pmc "manipRotateToggleXformConstraint" $constraintToggle; textField -ed false -width 131 -height 25 -ann `uiRes("m_manipMoveProperties.kManipMoveXformConstraintAnn")` manipRotateXformConstraintModeLabel; setParent ..; radioButtonGrp -nrb 2 -label $emptyLabel -label1 `uiRes("m_manipMoveProperties.kManipMoveXformConstraintAlongNormals")` -label2 `uiRes("m_manipMoveProperties.kManipMoveXformConstraintClosestPoint")` -an1 `uiRes("m_manipMoveProperties.kManipMoveXformConstraintAlongNormalsAnn")` -an2 `uiRes("m_manipMoveProperties.kManipMoveXformConstraintClosestPointAnn")` -cc1 ("setXformConstraintAlongNormal 1") -cc2 ("setXformConstraintAlongNormal 0") manipRotateXformConstraintAlongNormalRadioBtn; rowLayout -nc 4 -cw4 132 20 77 52; text -align right -l (uiRes("m_manipMoveProperties.kStepSnap")) -ann (uiRes("m_manipMoveProperties.kStepSnapAnn")) manipRotateSnapLabel; string $snapButton = `iconTextButton -w 17 -h 26 -image ("popupMenuIcon.png") -ann (uiRes("m_manipMoveProperties.kStepSnapAnn")) manipRotateSnapButton`; string $snapMenu = `popupMenu -b 1 -p $snapButton`; menu -e -pmc ("manipRotateBuildSnapMenu " + $snapMenu) $snapMenu; string $snapToggle = `popupMenu -b 2 -p $snapButton`; menu -e -pmc "manipRotateToggleSnapMode" $snapToggle; textField -ed false -width 77 -height 25 -ann `uiRes("m_manipMoveProperties.kStepSnapAnn")` manipRotateSnapModeLabel; floatField -w 52 -pre 2 -v 1.0 -cc "manipRotateContext -e -snapValue #1 $currManipRotatePropertiesCtx" manipRotateSnapValue; setParent ..; checkBoxGrp -label `uiRes("m_manipMoveProperties.kPreserveChildPos")` -ann `uiRes("m_manipMoveProperties.kPreserveChildPosAnn")` rotatePreserveChildCheckBx; checkBoxGrp -ncb 1 -label `uiRes("m_manipMoveProperties.kPreserveUVMove")` -label1 $emptyLabel -ann `uiRes("m_manipMoveProperties.kPreserveUVMoveAnn")` rotatePreserveUVCheckBx; checkBoxGrp -ncb 1 -vis true -label `uiRes("m_manipMoveProperties.kTweakMode")` -label1 "" -ann `uiRes("m_manipMoveProperties.kTweakModeAnn")` tweakModeCheckBox; checkBoxGrp -ncb 1 -label (uiRes("m_manipRotateProperties.kCenterTrackball")) -label1 $emptyLabel -ann (uiRes("m_manipRotateProperties.kCenterTrackballAnn")) manipCenterTrackball; setParent ..; setParent ..; commonSelectProperties(/*collapsed*/true, /*uvTool*/false); softSelectProperties(/*collapsed*/true, /*uvTool*/false); reflectionProperties(/*collapsed*/true, /*uvTool*/false); smartDupProperties(true); setParent ..; setUITemplate -popTemplate; }