// =========================================================================== // 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. // =========================================================================== source "dagMenuProc.mel"; global proc commonSelectionConstraintsPopupMenus() { int $mtkEnable = (`pluginInfo -q -loaded "modelingToolkit"`); string $tranCon = `xformConstraint -q -type`; menuItem -enable $mtkEnable -label (uiRes("m_polyCutUVOptionsPopup.kSelConstraintsLabel")) -subMenu 1; radioMenuItemCollection; int $bp = `polySelectConstraint -q -bp`; int $sh = `polySelectConstraint -q -sh`; int $ap = `polySelectConstraint -q -ap`; int $el = `polySelectConstraint -q -lp`; int $er = `polySelectConstraint -q -rp`; int $ulp = `polySelectConstraint -q -ulp`; menuItem -label (uiRes("m_polyCutUVOptionsPopup.kOff")) -radioButton (!$bp && !$sh && !$ap) -c "dR_selConstraintOff"; menuItem -label (uiRes("m_polyCutUVOptionsPopup.kAngle")) -radioButton ($ap) -c "dR_selConstraintAngle"; menuItem -label (uiRes("m_polyCutUVOptionsPopup.kBorder")) -radioButton ($bp) -c "dR_selConstraintBorder"; menuItem -label (uiRes("m_polyCutUVOptionsPopup.kEdgeLoop")) -radioButton ($el) -c "dR_selConstraintEdgeLoop"; menuItem -label (uiRes("m_polyCutUVOptionsPopup.kEdgeRing")) -radioButton ($er) -c "dR_selConstraintEdgeRing"; menuItem -label (uiRes("m_polyCutUVOptionsPopup.kShell")) -radioButton ($sh) -c "dR_selConstraintElement"; menuItem -label (uiRes("m_polyCutUVOptionsPopup.kUVEdgeLoop")) -radioButton($ulp) -c "dR_selConstraintUVEdgeLoop"; setParent -menu ..; } global proc polyCutUVMirrorTopoPopup() { string $cmd = "polyCutUVRestoreTool( \\\"" + `currentCtx` + "\\\")" ; pickTopoSymmetryEdge($cmd, 0); } global proc cutUVToolDoCutUVs() { int $inComponentMode = `selectMode -q -component`; int $inEdgeSelection = 0; int $inFaceSelection = 0; if($inComponentMode) { $inEdgeSelection = `selectType -q -edge`; $inFaceSelection = `selectType -q -facet`; } else { $inEdgeSelection = `selectType -q -ocm -edge`; $inFaceSelection = `selectType -q -ocm -facet`; } if (!$inEdgeSelection && !$inFaceSelection) return; string $list[] = `ls -sl`; if(size($list) == 0) $list = `ls -hl`; if(size($list) == 0) return; if( $inEdgeSelection ) CutUVs; else if( $inFaceSelection ) CreateUVShellAlongBorder; } global proc cutUVToolDoSewUVs() { int $inComponentMode = `selectMode -q -component`; int $inEdgeSelection = 0; int $inUVShellSelection = 0; if($inComponentMode) { $inEdgeSelection = `selectType -q -edge`; $inUVShellSelection = `selectType -q -meshUVShell`; } else { $inEdgeSelection = `selectType -q -ocm -edge`; $inUVShellSelection = `selectType -q -ocm -meshUVShell`; } if (!$inEdgeSelection && !$inUVShellSelection) return; string $list[] = `ls -sl`; if(size($list) == 0) $list = `ls -hl`; if(size($list) == 0) return; SewUVs; } global proc cutUVToolDoUnfoldLayoutUVs() { int $inComponentMode = `selectMode -q -component`; int $inUVShellSelection = 0; if($inComponentMode) $inUVShellSelection = `selectType -q -meshUVShell`; else $inUVShellSelection = `selectType -q -ocm -meshUVShell`; if (!$inUVShellSelection) return; string $list[] = `ls -sl`; if(size($list) == 0) $list = `ls -hl`; if(size($list) == 0) return; UnfoldUV; LayoutUV; } proc updateCutUVToolMM() { int $inComponentMode = `selectMode -q -component`; int $inEdgeSelection = 0; int $inFaceSelection = 0; int $inUVShellSelection = 0; if($inComponentMode) { $inEdgeSelection = `selectType -q -edge`; $inFaceSelection = `selectType -q -facet`; $inUVShellSelection = `selectType -q -meshUVShell`; } else { $inEdgeSelection = `selectType -q -ocm -edge`; $inFaceSelection = `selectType -q -ocm -facet`; $inUVShellSelection = `selectType -q -ocm -meshUVShell`; } if (`menuItem -exists cutUVToolCutUVMMItem`) menuItem -e -en ($inEdgeSelection || $inFaceSelection) cutUVToolCutUVMMItem; if (`menuItem -exists cutUVToolSewUVMMItem`) menuItem -e -en ($inEdgeSelection || $inUVShellSelection) cutUVToolSewUVMMItem; if (`menuItem -exists cutUVToolUnfoldLayoutMMItem`) menuItem -e -en ($inUVShellSelection) cutUVToolUnfoldLayoutMMItem; } global proc polyCutUVOptionsPopup() { global string $gSelect; string $tool = `currentCtx`; if ($tool == "superCutUVContext") $tool = "PolyCutUVCtx"; int $ss = `polyCutUVCtx -query -steadyStroke $tool`; int $sym = `polyCutUVCtx -query -symmetry $tool`; int $scm = `polyCutUVCtx -query -showCheckerMap $tool`; int $stb = `polyCutUVCtx -query -showTextureBorders $tool`; int $ssc = `polyCutUVCtx -query -showUVShellColoring $tool`; string $updateTexEditor = "if (textureWindowIsUVEditorOpen())\n" + "{\n" + " string $texWinName[] = `getPanel -sty polyTexturePlacementPanel`;\n" + " txtWndUpdateEditor( $texWinName[0], \"textureWindow\", \"null\", 101 );\n" + "}\n"; string $obj[] = `ls -hl -tail 1 -typ transform -typ shape`; menuItem -rp "N" -l (uiRes("m_polyCutUVOptionsPopup.kComponent")) -subMenu 1; menuItem -rp "N" -l (uiRes("m_polyCutUVOptionsPopup.kEdge")) -c ("doMenuComponentSelection( \"" + $obj[0] + "\", \"edge\")"); menuItem -rp "S" -l (uiRes("m_polyCutUVOptionsPopup.kFace")) -c ("doMenuComponentSelection( \"" + $obj[0] + "\", \"facet\")"); menuItem -rp "E" -l (uiRes("m_polyCutUVOptionsPopup.kUVShell")) -c ("doMenuComponentSelection( \"" + $obj[0] + "\", \"meshUVShell\")"); setParent -m ..; menuItem -rp "NE" -l (uiRes("m_polyCutUVOptionsPopup.kUnfoldLayout")) -en true -c ("cutUVToolDoUnfoldLayoutUVs") cutUVToolUnfoldLayoutMMItem; menuItem -rp "E" -l (uiRes("m_polyCutUVOptionsPopup.kCutUVs")) -en true -c ("cutUVToolDoCutUVs") cutUVToolCutUVMMItem; menuItem -rp "S" -l (uiRes("m_polyCutUVOptionsPopup.kExitTool")) -en true -c ("setToolTo $gSelect;"); menuItem -rp "SW" -l (uiRes("m_polyCutUVOptionsPopup.kSteadyStroke")) -en true -checkBox $ss -c ("polyCutUVCtx -edit -steadyStroke " + !$ss + " " + $tool); menuItem -rp "W" -l (uiRes("m_polyCutUVOptionsPopup.kSewUVs")) -en true -c ("cutUVToolDoSewUVs") cutUVToolSewUVMMItem; menuItem -rp "NW" -l (uiRes("m_polyCutUVOptionsPopup.kSymmetry")) -subMenu 1; menuItem -rp "N" -l (uiRes("m_polyCutUVOptionsPopup.kMirrorOff")) -c ("reflectionSetMode(\"none\")"); menuItem -rp "NE" -l (uiRes("m_polyCutUVOptionsPopup.kObjectX")) -c ("reflectionSetMode(\"objectx\")"); menuItem -rp "E" -l (uiRes("m_polyCutUVOptionsPopup.kObjectY")) -c ("reflectionSetMode(\"objecty\")"); menuItem -rp "SE" -l (uiRes("m_polyCutUVOptionsPopup.kObjectZ")) -c ("reflectionSetMode(\"objectz\")"); menuItem -rp "S" -l (uiRes("m_polyCutUVOptionsPopup.kTopo")) -c ("polyCutUVMirrorTopoPopup"); menuItem -rp "SW" -l (uiRes("m_polyCutUVOptionsPopup.kWorldX")) -c ("reflectionSetMode(\"worldx\")"); menuItem -rp "W" -l (uiRes("m_polyCutUVOptionsPopup.kWorldY")) -c ("reflectionSetMode(\"worldy\")"); menuItem -rp "NW" -l (uiRes("m_polyCutUVOptionsPopup.kWorldZ")) -c ("reflectionSetMode(\"worldz\")"); setParent -m ..; menuItem -l (uiRes("m_polyCutUVOptionsPopup.kShowCheckerMap")) -en true -checkBox $scm -c ("polyCutUVCtx -e -showCheckerMap " + !$scm + " " + $tool + "; " + $updateTexEditor); menuItem -l (uiRes("m_polyCutUVOptionsPopup.kShowTextureBorders")) -en true -checkBox $stb -c ("polyCutUVCtx -e -showTextureBorders " + !$stb + " " + $tool); menuItem -l (uiRes("m_polyCutUVOptionsPopup.kShowUVShellColoring")) -en true -checkBox $ssc -c ("polyCutUVCtx -e -showUVShellColoring " + !$ssc + " " + $tool + "; " + $updateTexEditor); menuItem -divider true; commonSelectionConstraintsPopupMenus(); updateCutUVToolMM(); }