/*
* Advanced weighting script X
* Wraith - Game extraction tools
*/

global proc WraithMesh_94d1ae50_00_BindFunc()
{
   select -r WraithMesh_94d1ae50_00;
   select -add j_mag1;
   newSkinCluster "-toSelectedBones -mi 15 -omi true -dr 5.0 -rui false";   string $clu = findRelatedSkinCluster("WraithMesh_94d1ae50_00");

   skinPercent -tv j_mag1 1.0 $clu WraithMesh_94d1ae50_00.vtx[0:1263];
}

global proc WraithMesh_94d1ae50_01_BindFunc()
{
   select -r WraithMesh_94d1ae50_01;
   select -add j_mag2;
   newSkinCluster "-toSelectedBones -mi 15 -omi true -dr 5.0 -rui false";   string $clu = findRelatedSkinCluster("WraithMesh_94d1ae50_01");

   skinPercent -tv j_mag2 1.0 $clu WraithMesh_94d1ae50_01.vtx[0:1263];
}

global proc WraithMesh_94d1ae50_02_BindFunc()
{
   select -r WraithMesh_94d1ae50_02;
   select -add j_bullet;
   select -add j_mag2;
   select -add j_mag1;
   newSkinCluster "-toSelectedBones -mi 15 -omi true -dr 5.0 -rui false";   string $clu = findRelatedSkinCluster("WraithMesh_94d1ae50_02");

   skinPercent -tv j_bullet 1.0 $clu WraithMesh_94d1ae50_02.vtx[0:296];
   skinPercent -tv j_mag2 1.0 $clu WraithMesh_94d1ae50_02.vtx[297:748];
   skinPercent -tv j_mag1 1.0 $clu WraithMesh_94d1ae50_02.vtx[749:903];
}

global proc WraithMesh_94d1ae50_03_BindFunc()
{
   select -r WraithMesh_94d1ae50_03;
   select -add j_mag1;
   select -add j_mag2;
   newSkinCluster "-toSelectedBones -mi 15 -omi true -dr 5.0 -rui false";   string $clu = findRelatedSkinCluster("WraithMesh_94d1ae50_03");

   skinPercent -tv j_mag1 1.0 $clu WraithMesh_94d1ae50_03.vtx[0:7];
   skinPercent -tv j_mag2 1.0 $clu WraithMesh_94d1ae50_03.vtx[8:15];
}

global proc RunAdvancedScript()
{
   catch(WraithMesh_94d1ae50_00_BindFunc());
   catch(WraithMesh_94d1ae50_01_BindFunc());
   catch(WraithMesh_94d1ae50_02_BindFunc());
   catch(WraithMesh_94d1ae50_03_BindFunc());
}

global proc NamespacePurge()
{
   string $allNodes[] = `ls`;
   for($node in $allNodes) {
      string $buffer[];
      tokenize $node ":" $buffer;
      string $newName = $buffer[size($buffer)-1];
       catchQuiet(`rename $node $newName`);
   }
}

print("Currently binding the current model, please wait...\n");
NamespacePurge();
RunAdvancedScript();
print("The model has been binded.\n");

