// =========================================================================== // 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: June 18, 1997 // // // // // // attributeExists (string $attr, string $node) // // // int : 1 if the attribute exists on the node, else 0 // // // Check to see if the named attribute exists in the // given node. // // // string $attr Name of attribute to look for. // string $node Name of node that will be searched. // // // string $shapeName[] = `cone`; // if (`attributeExists "scaleX" $shapeName[0]`) { // print "Attribute exists\n"; // } else { // print "Attribute does not exist\n"; // } // // ///////////////////////////////////////////////////////////////////////// global proc int attributeExists(string $attr, string $node) { if ("" == $attr || "" == $node) return 0; // check zero, see if the node exists! // if( !`objExists $node` ) return 0; // First check to see if the attribute matches the short names // string $attrList[] = `listAttr -shortNames $node`; int $max = size($attrList); int $i; for( $i = 0; $i<$max; $i++ ) { if( $attr == $attrList[$i] ) { return 1; } } // Now check against the long names // $attrList = `listAttr $node`; $max = size($attrList); for( $i = 0; $i<$max; $i++ ) { if( $attr == $attrList[$i] ) { return 1; } } return 0; }