// =========================================================================== // 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. // =========================================================================== proc colorizeNode (string $object, int $colorIndex, int $state) { if (objExists($object) == false) return; // Keep the color index within the user color range // if (($colorIndex < 0) || ($colorIndex > 7)) $colorIndex = 0; if (`nodeType $object` == "joint") { setAttr ($object + ".useObjectColor") $state; if ($state) setAttr ($object + ".objectColor") $colorIndex; } // Now colorize the children // string $children[] = `listRelatives -fullPath -children $object`; for ($child in $children) { colorizeNode($child, $colorIndex+1, $state); } } global proc colorizeSkeleton (string $object, int $state) { colorizeNode($object, 0, $state); }