// =========================================================================== // 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 plugMultiAttrs(string $plug) // // // string[] : any multi attrs in the plug's attribute hierarchy // // // If the plug's attribute or any of its parents are multi's, this // procedure returns them in an array. // // // string $plug The plug of interest. // // // // Find the multi attr parent of the xValue attribute // plugMultiAttrs "pCylinderShape1.pnts.xValue"; // // Result: pnts // // // plugMultiAttrs "cluster1.weightList.weights"; // // Result: weightList.weights weightList // // // global proc string[] plugMultiAttrs(string $plug) { string $rtn[]; string $buffer[]; tokenize($plug, ".", $buffer); string $node = $buffer[0]; if (! `objExists $node` ) { string $errMsg = (uiRes("m_plugMultiAttrs.kObjNotFound")); $errMsg = `format -s $node $errMsg`; error($errMsg); } int $count = size($buffer) - 1; while ($count > 0) { string $attr = $buffer[$count]; if (`attributeQuery -multi -node $node $attr`) { string $fullAttrString = $buffer[1]; for ($i = 2; $i <= $count; $i++) { $fullAttrString += ("." + $buffer[$i]); } $rtn[size($rtn)] = $fullAttrString; } $count--; } return $rtn; }