/////////////////////////////////////////////////////// // cleanCopy.mel // // Sean Nolan // sean@snolan.net // // Makes a clean copy of of skinned geo. // Able to make geo modifications after you skinned charater. // (ie. Lattice, cluster deformations, delete faces, add faces, // add more detail, ect...) Also makes sure that the geo has // clean skinned channels. // // Description :It will delete history and copy the skin wieghts // from the original geo to the duplicated one and rename the // new one accordingly. // // Usage: Select Geo and run // Ignore the error at the end /////////////////////////////////////////////////////// global proc cleanCopy() { string $sel[] = `ls -sl`; int $numSel = `size($sel)`; //for all selected geo for($index = 0; $index < $numSel; $index++) { string $boneList[] = `skinCluster -q -inf $sel[$index]`; int $maxInf = `skinCluster -q -mi $sel[$index]`; string $dupGeo[] = `duplicate -rr $sel[$index]`; string $oldSkinCluster = `findRelatedSkinCluster($sel[$index])`; string $newCluster[] = `skinCluster -toSelectedBones -dropoffRate 4 $boneList $dupGeo`; string $newSkinCluster = `findRelatedSkinCluster($dupGeo[$index])`; copySkinWeights -ss $oldSkinCluster -ds $newCluster -noMirror; delete $sel[$index]; rename $dupGeo[$index] $sel[$index]; select -r $sel[$index]; print ($sel[$index] + "copied and cleaned \n"); } }