// =========================================================================== // 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. // =========================================================================== // // // // // // // string[] lsType( string $type ) // // // Return object names of the given type. // The end of the return array is marked with the special // string "<>" for two reasons. There is no way to // return an empty array, and the array values are not // cleared from call to call. This means that values from // a previous call will be returned on the next call. // // // string $type Type of object to look for // // // string[] : List of all objects of the named type, terminated with // an entry with the string "<>". // // // // sphere -n sphere1; // sphere -n sphere2; // lsType("nurbsSurface"); // // Result: sphere1Shape sphere2Shape // // // // global proc string[] lsType( string $type ) { int $i, $count; string $list[]; string $names[]; $list = `ls -showType`; for ($i = 1, $count = 0; $i < size( $list ); $i += 2 ) { if ($list[$i] == $type) { $names[$count] = $list[$i-1]; $count++; } } $names[$count] = ""; return( $names ); } // lsType //