// =========================================================================== // 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. // =========================================================================== // // Procedure Name: // contextPolyToolsMappingMM // // Description: // This procedure creates the popup/marking menu // for poly mapping tools. See contextPolyToolsMM. // // Input Arguments: // None // // Return Value: // None. global proc contextPolyToolsMappingMM(){ menuItem -label (uiRes("m_contextPolyToolsMM.kMapping")) -subMenu 1 -tearOff 0 -allowOptionBoxes 1 -postMenuCommandOnce 0 ; menuItem -label (uiRes("m_contextPolyToolsMM.kPlanarMapX")) -command "ConvertSelectionToFaces; polyProjection -ch 1 -type Planar -ibd on -icx 0.5 -icy 0.5 -ra 0 -isu 1 -isv 1 -md x ;setToolTo ShowManips" -enableCommandRepeat 1 -image "polyPlanProjLarge.png" ; menuItem -label (uiRes("m_contextPolyToolsMM.kPlanarMapY")) -command "ConvertSelectionToFaces; polyProjection -ch 1 -type Planar -ibd on -icx 0.5 -icy 0.5 -ra 0 -isu 1 -isv 1 -md y ;setToolTo ShowManips;" -enableCommandRepeat 1 -image "polyPlanProjLarge.png" ; menuItem -label (uiRes("m_contextPolyToolsMM.kPlanarMapZ")) -command "ConvertSelectionToFaces; polyProjection -ch 1 -type Planar -ibd on -icx 0.5 -icy 0.5 -ra 0 -isu 1 -isv 1 -md z ;setToolTo ShowManips;" -enableCommandRepeat 1 -image "polyPlanProjLarge.png" ; menuItem -label (uiRes("m_contextPolyToolsMM.kPlanarMap")) -command "performPolyProjectionArgList \"1\" {\"0\", \"Planar\", \"ls -sl\", \"0\"} \"\"" -enableCommandRepeat 1 -image "polyPlanProjLarge.png" ; menuItem -label (uiRes("m_contextPolyToolsMM.kPlanarMapOptions")) -command "performPolyProjectionArgList \"1\" {\"1\", \"Planar\", \"ls -sl\", \"0\"} \"\"" -optionBox 1 -enableCommandRepeat 1 ; menuItem -divider 1 ; menuItem -label (uiRes("m_contextPolyToolsMM.kCylindricalMap")) -command "ConvertSelectionToFaces; polyProjection -ch 1 -type Cylindrical -ibd on -icx 0.5 -icy 0.5 -ra 0 -isu 1 -isv 1 -sf on ; setToolTo ShowManips;" -enableCommandRepeat 1 -image "polyCylProjLarge.png" ; menuItem -label (uiRes("m_contextPolyToolsMM.kCylindricalMapOptions")) -command "performPolyProjectionArgList \"1\" {\"1\", \"Cylindrical\", \"ls -sl\", \"0\"} \"\"" -optionBox 1 -enableCommandRepeat 1 ; menuItem -label (uiRes("m_contextPolyToolsMM.kSphericalMap")) -command "ConvertSelectionToFaces; polyProjection -ch 1 -type Spherical -ibd on -icx 0.5 -icy 0.5 -ra 0 -isu 1 -isv 1 -sf on ; setToolTo ShowManips;" -enableCommandRepeat 1 -image "polySphereProjLarge.png" ; menuItem -label (uiRes("m_contextPolyToolsMM.kSphericalMapOptions")) -command "performPolyProjectionArgList \"1\" {\"1\", \"Spherical\", \"ls -sl\", \"0\"} \"\"" -optionBox 1 -enableCommandRepeat 1 ; menuItem -divider 1 ; menuItem -label (uiRes("m_contextPolyToolsMM.kAutomaticMap")) -command "performPolyAutoProj 0" -enableCommandRepeat 1 -image "polyAutoProjLarge.png" ; menuItem -label (uiRes("m_contextPolyToolsMM.kAutomaticMapOptions")) -command "performPolyAutoProj 1" -optionBox 1 -enableCommandRepeat 1 ; menuItem -label (uiRes("m_contextPolyToolsMM.kCameraBasedMap")) -version "2018" -command "UVCameraBasedProjection" -enableCommandRepeat 1 -image "polyCameraProj.png" ; menuItem -command "UVCameraBasedProjectionOptions" -optionBox 1 -enableCommandRepeat 1 ; menuItem -label (uiRes("m_contextPolyToolsMM.kNormalBasedMap")) -version "2018" -command "UVNormalBasedProjection" -enableCommandRepeat 1 -image "polyNormalProj.png" ; menuItem -command "UVNormalBasedProjectionOptions" -optionBox 1 -enableCommandRepeat 1 ; setParent -menu ..; } // // Procedure Name: // contextPolyToolsMM // // Description: // This procedure creates the popup/marking menu // for poly tools. See ModelEdMenu. // // Input Arguments: // The parent item to parent the popup menu to. // // Return Value: // None. global proc int contextPolyToolsMM(string $parent) { if (`popupMenu -query -exists $parent`) { popupMenu -edit -deleteAllItems $parent; setParent -menu $parent; string $currentContext = `currentCtx`; if (`contextInfo -exists $currentContext`) { string $ctx = `contextInfo -c $currentContext`; if ($ctx == "sculptMeshCache") { sculptMeshCacheConvertMM(); return 1; } } string $selection[] = `ls -long -selection`; if (0 == size( $selection )) { $selection = `ls -preSelectHilite`; } // // Poly vertex is selected. // string $vertexList[] = `filterExpand -expand false -selectionMask 31 $selection`; if (0 != `size($vertexList)`) { contextPolyToolsVertexMM; // allow user to define a proc with additional menu items if (`exists contextPolyToolsVertexUserMM`) contextPolyToolsVertexUserMM $parent; return 1; } // // Poly face is selected. // string $faceList[] = `filterExpand -expand false -selectionMask 34 $selection`; if (0 != `size($faceList)`) { if (`selectType -q -meshUVShell`) { contextPolyToolsUVShellMM; } else { contextPolyToolsFaceMM; // allow user to define a proc with additional menu items if (`exists contextPolyToolsFaceUserMM`) contextPolyToolsFaceUserMM $parent; } return 1; } // // Poly edge is selected. // string $edgeList[] = `filterExpand -expand false -selectionMask 32 $selection`; if (0 != `size($edgeList)`) { contextPolyToolsEdgeMM; // allow user to define a proc with additional menu items if (`exists contextPolyToolsEdgeUserMM`) contextPolyToolsEdgeUserMM $parent; return 1; } // // Poly uv is selected. // string $uvList[] = `filterExpand -expand false -selectionMask 35 $selection`; if (0 != `size($uvList)`) { contextPolyToolsUVMM; // allow user to define a proc with additional menu items if (`exists contextPolyToolsUVUserMM`) contextPolyToolsUVUserMM $parent; return 1; } // // Poly object is selected. // string $polyObjectList[] = `filterExpand -expand false -selectionMask 12 $selection`; if (0 != `size($polyObjectList)`) { contextPolyToolsObjectMM; // allow user to define a proc with additional menu items if (`exists contextPolyToolsObjectUserMM`) contextPolyToolsObjectUserMM $parent; return 1; } } return 0; }