// =========================================================================== // 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: 30 April 1998 // // // Description: // A function to hide/show the selected CVs on a nurbs surface. // global proc selectiveCvsDisplay( int $hide ) // // $hide == 1 : hide the cvs that are not selected on the surface by turning // on the selective cv display attribute for the surface. // // $hide == 0 : show all the cvs on the selected surface by turning off the // selective cv display attribute for the surface. // { // get the list of objects selected with CV components. // global int $gSelectCVsBit; string $surfaceList[] = `filterExpand -ex false -sm $gSelectCVsBit`; int $numSurfaces = size($surfaceList); string $warning = (uiRes("m_selectiveCvsDisplay.kNoCVsOnANURBSSurfaceSelected")); if ( $numSurfaces == 0 ) { warning($warning); return; } // from the items with CVs selected, get the name of the object only // (ignoring the component) - this will also filter the list to // ignore duplicate items // $surfaceList = `ls -sl -o $surfaceList`; // now select the objects that had CVs selected and filter that list // for nurbs surfaces only // global int $gSelectNurbsSurfacesBit; $surfaceList = `filterExpand -ex false -sm $gSelectNurbsSurfacesBit $surfaceList`; $numSurfaces = size($surfaceList); if ( $numSurfaces == 0 ) { warning($warning); return; } // turn on/off the selective CV display for the nurbs surfaces // int $i; int $isAlreadySelective; for ( $i = 0; $i < $numSurfaces; $i++ ) { // if setting the attribute on the surface to true/false but the // attribute is already true/false, then no need to do a setAttr again // $isAlreadySelective = eval("getAttr " + $surfaceList[$i] + ".scvd"); if ( $hide == $isAlreadySelective ) { if ( $hide == 1 ) warning (uiRes("m_selectiveCvsDisplay.kSelectiveCVDisplayIsAlreadyOnForThisSurface")); else warning (uiRes("m_selectiveCvsDisplay.kSelectiveCVDisplayIsAlreadyOffForThisSurface")); continue; } eval("setAttr " + $surfaceList[$i] + ".scvd " + $hide); } }