// =========================================================================== // 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. // =========================================================================== // // // Creation Date: 11 January 2002 // // Procedure Name: // buildConvertMM // // Description: // This procedure creates the popup/marking menu // for surface component conversion (ctrl RMB) // that gets attached to the main view panes. // This menu builds dynamically, and changes its // contents based on what item the mouse is clicked // over. // // Input Arguments: // The parent item to parent the popup menu to. // // Return Value: // None. global proc buildConvertMM(string $parent) { // first determine the lead object (last selected object) string $leadObject[] = `ls -selection -long -tail 1`; string $shape[]; if (0 < size($leadObject)){ // user must have something selected // generally it's components $shape = `listRelatives -parent -shapes -fullPath $leadObject[0]`; // but it may be objects if (size($shape) < 1) { $shape = `listRelatives -children -shapes -fullPath $leadObject[0]`; if (size($shape) < 1) { // It could be that the lead object is something entirely different // Look for common cases, where the next lead object could be a good choice // string $leadObject2[] = `ls -selection -long -tail 2`; if (size($leadObject2) > 1) $leadObject[0] = $leadObject2[0]; // components? $shape = `listRelatives -parent -shapes -fullPath $leadObject[0]`; // or objects? if (size($shape) < 1) { $shape = `listRelatives -children -shapes -fullPath $leadObject[0]`; } } } } else { $shape[0] = ""; } // build the appropriate conversion marking menu string $nodeType; if( $shape[0] != "") { $nodeType = `nodeType $shape[0]`; if ($nodeType == "mesh" || $nodeType == "nurbsSurface" || $nodeType == "subdiv" || $nodeType == "nurbsCurve" || $nodeType == "bezierCurve" ) { $nodeType = $nodeType; } else { $nodeType = "noConversion"; } // if there is no appropriate conversion marking menu // build the windows marking menu } else { $nodeType = "noConversion"; } switch( $nodeType ) { case "mesh": polyConvertMM( $parent ); break; case "nurbsSurface": nurbsConvertMM( $parent ); break; case "subdiv": subdConvertMM( $parent ); break; case "nurbsCurve": curveConvertMM( $parent, 0 ); // $isBezier = 0 break; case "bezierCurve": curveConvertMM( $parent, 1 ); // $isBezier = 1 break; case "noConversion": buildObjectMenuItemsNow( $parent ); break; default: break; } }