Advertisement
Guest User

checkMaxSkinInfluences.mel

a guest
Dec 22nd, 2014
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. // in button (for over 2):
  2.  
  3. string $select[] = `ls -sl`;
  4. string $object = $select[0];
  5. checkMaxSkinInfluences($object, 2);
  6.  
  7. // checkMaxSkinInfluences.mel
  8.  
  9. global proc checkMaxSkinInfluences(string $mesh, int $maxInfluences)
  10. {
  11. select -cl;
  12. string $skinCluster = `findRelatedSkinCluster $mesh`;
  13. if($skinCluster == "") error ("checkSkinInfluences: can't find skinCluster connected to '" + $mesh + "'.\n");
  14.  
  15. int $verts[] = `polyEvaluate -v $mesh`;
  16. int $count;
  17. int $i;
  18. for($i=0;$i<($verts[0]+1);$i++)
  19. {
  20. float $inf[] = `skinPercent -query -value $skinCluster ($mesh + ".vtx[" + $i + "]")`;
  21. float $activeInf[] = {};
  22. int $j;
  23. for($j=0;$j<size($inf);$j++)
  24. {
  25. if($inf[$j]>0) $activeInf[size($activeInf)] = $inf[$j];
  26. }
  27.  
  28. if(size($activeInf) > $maxInfluences)
  29. {
  30. select -add ($mesh + ".vtx["+$i+"]");
  31. $count++;
  32. }
  33. }
  34.  
  35. if($count > 0) warning ("More than " + $maxInfluences + " influences for " + $count + " verts on " + $mesh + "\n");
  36. else print ("Found no verts with more than " + $maxInfluences + " on " + $mesh + "\n");
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement