/* NAME: dbMultiRename.mel VERSION: 1.0 CATEGORY: Rigging FUNCTION: This script renames multiple heirarchies at a time. Useful if you have a number of joint chains as hair strands, for instance. Select the root joint of each strand, run the script, and it will rename each strand to {hairStrand_1_1", "hairStrand_1_2", ... , "hairStrand_1_n"}, {hairStrand_2_1", "hairStrand_2_2", ... , "hairStrand_2_n"}, etc. USAGE: 1. Copy the dbMultiRename.mel into your Maya Scripts directory (Usually found in "My Documents\maya\\scripts\"). 2. In the Maya Script Editor, type in "source dbMultiRename.mel; dbMultiRename;" AUTHOR: David Bokser E-MAIL: me@davidbokser.com WEBSITE: www.davidbokser.com */ global proc dbMultiRename() { // Make a new window // string $window = `window -title "Multi Rename" -iconName "MultiRename" -widthHeight 200 93`; columnLayout -adjustableColumn true; textField renameField; button -label "Rename" -c ("string $rename = `textField -q -text renameField`; mrRename($rename);"); button -label "Close" -command ("deleteUI -window " + $window); setParent ..; showWindow $window; // Resize the window // window -edit -widthHeight 200 93 $window; } global proc mrRename(string $rename) { string $topChain[] = `ls -sl`; string $jointChain[]; string $newTopChain[] = {}; int $objCnt = size($topChain); int $chainCnt; int $i; int $p; string $topNum; string $jointNum; for ($i = 0; $i < $objCnt; $i++) { select -hi $topChain[$i]; $jointChain = `ls -sl`; $chainCnt = size($jointChain); $topNum = ($i + 1); for ($p = $chainCnt - 1; $p >= 0; $p--) { $jointNum = ($p + 1); rename $jointChain[$p] ($rename + $topNum + "_" + $jointNum); if($p == 0) { $newTopChain[`size($newTopChain)`] = ($rename + $topNum + "_" + $jointNum); } } } select -r $newTopChain; }