// =========================================================================== // 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: 2005 // // Description: // // proc int objIsDrawn(string $shape) // // Return 0 if the shape's visibility is off or if it is in a hidden layer // { int $vis = `getAttr ($shape+".visibility")`; if (0 == $vis) { return 0; } string $layer = objectLayer($shape); $vis = `getAttr ($layer+".visibility")`; if (0 == $vis) { if (`getAttr ($layer+".enabled")`) { return 0; } } return 1; } global proc string[] getGeometriesToCache() { string $shapes[] = `ls -sl -type shape`; if (0 == size($shapes)) { string $obj; string $sel[] = `ls -sl -type transform`; for ($selObj in $sel) { int $cachableChildCount = 0; string $objects[] = `listRelatives -pa -ni -shapes -type shape $selObj`; for( $obj in $objects ) { if( size(`ls -type deformableShape $obj`) == 1 && objIsDrawn($obj)) { $shapes[size($shapes)] = $obj; $cachableChildCount++; } } clear $objects; if ($cachableChildCount > 1) { string $format = (uiRes("m_getGeometriesToCache.kMoreThanOneCandidate")); string $errMsg = `format -stringArg $selObj $format`; error($errMsg); } } } // append any additional geometries that are in cache groups with // the specified geometries // int $ii, $shapeCount = size($shapes); for ($ii = 0; $ii < $shapeCount; $ii++) { string $caches[] = findExistingCaches($shapes[$ii]); for ($cache in $caches) { string $geoms[] = `cacheFile -q -geometry $cache`; for ($geom in $geoms) { string $isControlPoint[] = `ls -type controlPoint $geom`; if (size($isControlPoint) > 0) { if (0 == stringArrayCount($geom,$shapes)) { $shapes[size($shapes)] = $geom; } } } } } return $shapes; }