Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.53 KB | None | 0 0
  1. {
  2. // Make sure we're in object mode, otherwise some currently selected faces can mess this up.
  3. // Need to switch on component mode first to make this work in all cases.
  4. changeSelectMode -component;
  5. changeSelectMode -object;
  6.  
  7. // Select all face components
  8. select -r `listTransforms "-type mesh -visible"`;
  9. PolySelectConvert 1;
  10.  
  11. // Filter the selection to only ngon faces.
  12. // -sz 1 is for tris, 2 is for quads, 3 is for ngons
  13. polySelectConstraint -t 8 -m 2 -sz 3;
  14. $ngonFaces = `ls -sl`;
  15.  
  16. // Select all faces again, filter to triangles.
  17. select -r `listTransforms "-type mesh -visible"`;
  18. PolySelectConvert 1;
  19. polySelectConstraint -t 8 -m 2 -sz 1;
  20.  
  21. // Turn off the selection constraint.
  22. polySelectConstraint -m 0 -sz 0;
  23.  
  24. // Reselect triangles
  25. select -add $ngonFaces;
  26. // A hack to deselect other objects we don't care about
  27. select -r `ls -sl`;
  28.  
  29. $nonQuadFaces = `ls -sl`;
  30. // ls -sl -o gives us shape nodes but we want their parent transforms instead
  31. $nonQuadShapes = `ls -sl -o`;
  32. $nonQuadObjects = `listRelatives -p $nonQuadShapes`;
  33.  
  34. // Only hilite objects containing selected faces.
  35. hilite -r $nonQuadObjects;
  36.  
  37.  
  38. $msg = "No visible non-quad faces.";
  39. if (size($nonQuadFaces) > 0) {
  40. // Query number of selected faces.
  41. $_countNonQuads = `polyEvaluate -faceComponent`;
  42. $countNonQuads = $_countNonQuads[0];
  43.  
  44. // Switch to face component selection mode.
  45. SelectTool;
  46. changeSelectMode -component;
  47. selectType -allComponents 0 -polymeshFace 1;
  48.  
  49. $msg = $countNonQuads + " non-quad faces selected.";
  50. }
  51.  
  52. inViewMessage -smg $msg -fade -pos topCenter;
  53. print($msg + "\n");
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement