// =========================================================================== // 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: Nov 4, 1999 // // Procedure: // subdGivenIntoHierMode // // Description: // Given a subdivision surface (with no construction history), // create a polygon. For more details see the description // with "subdGivenIntoPolyMode" function below. // global proc subdGivenIntoHierMode( string $subd ) // // Description: // Just delete the object history completelly. // // Ordinarilly, this would be called with a subdivision surface as $subd. // However, dagMenuProc.mel may call it with a transform above it instead, // so we do a filterExpand, just in case. { global int $gSelectSubdivSurface; string $list[] = `filterExpand -ex 1 -fp 1 -sm $gSelectSubdivSurface $subd`; int $len = size($list); if( $len > 0 ) { $subd = $list[0]; } int $whichMode = `subdiv -q -proxyMode $subd`; if( 2 == $whichMode ) { error( (uiRes("m_subdGivenIntoHierMode.kErrorWouldDeleteHistory")) ); return; } else if( 0 == $whichMode ) { warning((uiRes("m_subdGivenIntoHierMode.kWarningAlreadyStandardMode")) ); return; } // Delete the polygon proxy, and the construction // history on the subdiv surface. // string $polyToRemove = `subdFindProxyModePolygon( $subd )`; string $otherPolyToRemove = ""; // delete contruction history on the poly proxy first delete -ch $polyToRemove; // Its possible that we had the extra intermediate poly in there, // because of the multiple 64 edit blind data nodes... if( "" != $polyToRemove ) { string $others[] = `listConnections -sh 1 -d 0 -s 1 ($polyToRemove + ".i")`; if( size($others) > 0 ) { if( ("mesh" == `nodeType $others[0]`) && (1 == `getAttr ($others[0] + ".io")`) ) { $otherPolyToRemove = $others[0]; } } } delete -ch $subd; delete $polyToRemove; if( "" != $otherPolyToRemove ) { delete $otherPolyToRemove; } // Done. Un-template the subd if necessary: // toggle -template -state off $subd; // Force refresh of Subd HUD if necessary if (`exists updateSubdHUD`) { updateSubdHUD(); } }