// =========================================================================== // 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: // subdFindPolyForHierMode // // Description: // Given a subdivision surface (with construction history), // return the name of the upstream polygon used when in // "polygon proxy" mode. // global proc string subdFindProxyModePolygon( string $subd ) { string $result = ""; // 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]; } // If we're not in polygon mode, no point in looking // for the polygon proxy. // int $whichMode = `subdiv -q -proxyMode $subd`; if( 1 != $whichMode ) { error( `format -s $subd (uiRes("m_subdFindProxyModePolygon.kErrorNotInPolygonMode"))` ); return $result; } string $hist[] = `listHistory $subd`; for( $histNode in $hist ) { if( "mesh" == `nodeType $histNode` ) { $result = $histNode; break; } } return $result; }