// =========================================================================== // 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 polyCutUVSteadyStrokeCBFromUIToObject( string $parent, string $context ) { setParent $parent; int $ss = `checkBoxGrp -query -value1 polyCutUVToolSetSteadyStroke`; polyCutUVCtx -edit -steadyStroke $ss $context; if ( $ss) { floatSliderGrp -edit -en true polyCutUVToolSetSteadyStrokeDistance; } else { floatSliderGrp -edit -en false polyCutUVToolSetSteadyStrokeDistance; } } global proc polyCutUVSteadyStrokeChangedFromObjectToUI() { int $ss = `polyCutUVCtx -query -steadyStroke PolyCutUVCtx`; checkBoxGrp -edit -value1 $ss polyCutUVToolSetSteadyStroke ; if ( $ss) { floatSliderGrp -edit -en true polyCutUVToolSetSteadyStrokeDistance; } else { floatSliderGrp -edit -en false polyCutUVToolSetSteadyStrokeDistance; } } global proc polyCutUVSteadyStrokeDistanceCBFromUIToObject( string $parent, string $context ) { setParent $parent; float $ssd = `floatSliderGrp -query -value polyCutUVToolSetSteadyStrokeDistance`; polyCutUVCtx -edit -steadyStrokeDistance $ssd $context; } global proc polyCutUVToolLoopSpeedCBFromUIToObject(string $parent, string $context) { setParent $parent; int $lsp = `intSliderGrp -query -value polyCutUVToolLoopSpeed`; polyCutUVCtx -edit -loopSpeed $lsp $context; } global proc polyCutUVToolTextureBordersCBFromUIToObject( string $parent, string $context) { setParent $parent; int $stb = `checkBoxGrp -query -value1 polyCutUVToolSetShowTextureBorders`; polyCutUVCtx -e -showTextureBorders $stb $context; if ($stb) { colorSliderGrp -edit -en true polyCutUVToolTextureBordersColorValue; } else { colorSliderGrp -edit -en false polyCutUVToolTextureBordersColorValue; } } global proc polyCutUVShowTextureBordersChangedFromObjectToUI() { int $stb = `polyCutUVCtx -query -showTextureBorders PolyCutUVCtx`; checkBoxGrp -edit -en true -value1 $stb polyCutUVToolSetShowTextureBorders; if ($stb) { colorSliderGrp -edit -en true polyCutUVToolTextureBordersColorValue; } else { colorSliderGrp -edit -en false polyCutUVToolTextureBordersColorValue; } } global proc polyCutUVToolUVMapBorderColorCBFromUIToObject(string $parent, string $context) { setParent $parent; float $color1[] = `colorSliderGrp -q -rgb polyCutUVToolTextureBordersColorValue`; polyCutUVCtx -e -mapBordersColor $color1[0] $color1[1] $color1[2] $context; } global proc polyCutUVRestoreTool(string $toolName) { string $cmd = "setToolTo " + $toolName; evalDeferred $cmd; } global proc polyCutUVToolSetSymmetryCB( string $parent, string $context ) { int $newVal = `optionMenuGrp -q -select polyCutUVToolSetSymmetry_OMG` - 1; polyCutUVCtx -e -symmetry $newVal $context; string $mode = "none"; switch( $newVal ) { case 1: $mode = "objectx"; break; case 2: $mode = "objecty"; break; case 3: $mode = "objectz"; break; case 4: $mode = "worldx"; break; case 5: $mode = "worldy"; break; case 6: $mode = "worldz"; break; case 7: $mode = "topo"; break; } if( $mode != "topo" ) reflectionSetMode( $mode ); else { // Have to handle topo sym differently, because reflectionSetMode will switch to the selection tool. // (to pick the symmetry edge) and afterwards we want Maya to switch back to the sculpting tool. string $cmd = "polyCutUVRestoreTool( \\\"" + `currentCtx` + "\\\")" ; pickTopoSymmetryEdge($cmd, 0); } } global proc polyCutUVMirrorValue() { int $mirror = 0; if( `symmetricModelling -q -s` == 1 ) { if( `symmetricModelling -q -ts` != "" ) { $mirror = 7; } else { $mirror = `symmetricModelling -q -about` == "world" ? 4 : 1; string $axis = `symmetricModelling -q -axis`; if( $axis == "y" ) $mirror += 1; else if( $axis == "z" ) $mirror += 2; } } $mirror += 1; optionMenuGrp -e -select $mirror polyCutUVToolSetSymmetry_OMG; } global proc polyCutUVCheckerDisplayChangedFromObjectToUI() { int $scm = `polyCutUVCtx -query -showCheckerMap PolyCutUVCtx`; checkBoxGrp -edit -value1 $scm polyCutUVToolSetShowCheckerMap; } global proc polyCutUVShowUVShellColoringChangedFromObjectToUI() { int $ssc = `polyCutUVCtx -query -showUVShellColoring PolyCutUVCtx`; checkBoxGrp -edit -en true -value1 $ssc polyCutUVToolSetShowUVShellColoring; } global proc polyCutUVValues_ResetTool( string $toolName ) { // set the generic default values that are common to all tools polyCutUVCtx -e -steadyStroke 0 -steadyStrokeDistance 4 -showCheckerMap 0 -showTextureBorders 1 -mapBordersColor 1 1 1 -showUVShellColoring 1 -loopSpeed 1 $toolName; reflectionSetMode( "none" ); polyCutUVValues($toolName); } global proc polyCutUVValues(string $toolName) { string $parent = `toolPropertyWindow -query -location`; setParent $parent; int $ss = `polyCutUVCtx -query -steadyStroke $toolName`; float $ssd = `polyCutUVCtx -query -steadyStrokeDistance $toolName`; int $scm = `polyCutUVCtx -query -showCheckerMap $toolName`; int $stb = `polyCutUVCtx -query -showTextureBorders $toolName`; float $mbc[] = `polyCutUVCtx -query -mapBordersColor $toolName`; int $ssc = `polyCutUVCtx -query -showUVShellColoring $toolName`; int $loopSpeed = `polyCutUVCtx -query -ls $toolName`; string $updateTexEditor = "if (textureWindowIsUVEditorOpen())\n" + "{\n" + " string $texWinName[] = `getPanel -sty polyTexturePlacementPanel`;\n" + " txtWndUpdateEditor( $texWinName[0], \"textureWindow\", \"null\", 101 );\n" + "}\n"; checkBoxGrp -edit -en true -changeCommand ("polyCutUVSteadyStrokeCBFromUIToObject " + $parent + " " + $toolName) -value1 $ss polyCutUVToolSetSteadyStroke ; floatSliderGrp -edit -en $ss -changeCommand ("polyCutUVSteadyStrokeDistanceCBFromUIToObject " + $parent + " " + $toolName) -value $ssd polyCutUVToolSetSteadyStrokeDistance; optionMenuGrp -edit -en true -cc ("polyCutUVToolSetSymmetryCB " + $parent + " " + $toolName) polyCutUVToolSetSymmetry_OMG; polyCutUVMirrorValue(); intSliderGrp -edit -en true -cc ("polyCutUVToolLoopSpeedCBFromUIToObject " + $parent + " " + $toolName) -value $loopSpeed polyCutUVToolLoopSpeed; checkBoxGrp -edit -en true -cc1 ("polyCutUVCtx -e -showCheckerMap #1 " + $toolName + "; " + $updateTexEditor) -value1 $scm polyCutUVToolSetShowCheckerMap; checkBoxGrp -edit -en true -cc1 ("polyCutUVToolTextureBordersCBFromUIToObject " + $parent + " " + $toolName) -value1 $stb polyCutUVToolSetShowTextureBorders; colorSliderGrp -edit -en true -rgb $mbc[0] $mbc[1] $mbc[2] -cc ("polyCutUVToolUVMapBorderColorCBFromUIToObject " + $parent + " " + $toolName ) polyCutUVToolTextureBordersColorValue; checkBoxGrp -edit -en true -cc1 ("polyCutUVCtx -e -showUVShellColoring #1 " + $toolName + "; " + $updateTexEditor) -value1 $ssc polyCutUVToolSetShowUVShellColoring; string $helpTag = "PolyCutUVTool"; toolPropertySetCommon $toolName "CutSewUVTool.png" $helpTag; toolPropertySelect "polyCutUV"; string $reset = `toolPropertyWindow -query -resetButton`; button -edit -enable true -command ("polyCutUVValues_ResetTool \"" + $toolName + "\"") $reset; }