Advertisement
smithincanton

JointPadding

Jun 11th, 2013
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. // Get the name of the selected node only if it's a joint
  2.  
  3. string $select[] = `ls -sl -type joint`;
  4.  
  5. // Check to make sure we have at least one joint selected
  6.  
  7. if (size($select) == 0)
  8. error ("You have no joints selected.\n");
  9.  
  10. // Strip the join name to a base name
  11.  
  12. string $basename = startString($select[0],((size($select[0]))-4));
  13.  
  14. // Take the base name and make two pads
  15.  
  16. group -empty -name($basename + "pad1");
  17.  
  18. group -name($basename + "pad0");
  19.  
  20. // Combine the base name and pad name
  21.  
  22. string $dpad0 = $basename + "pad0";
  23.  
  24. // Set the root pad's rotation to the selected joint's
  25.  
  26. setAttr ($dpad0 + ".rotateX") (getAttr($select[0] + ".jointOrientX"));
  27. setAttr ($dpad0 + ".rotateY") (getAttr($select[0] + ".jointOrientY"));
  28. setAttr ($dpad0 + ".rotateZ") (getAttr($select[0] + ".jointOrientZ"));
  29.  
  30. // Do the same for translate
  31.  
  32. setAttr ($dpad0 + ".translateX") (getAttr($select[0] + ".translateX"));
  33. setAttr ($dpad0 + ".translateY") (getAttr($select[0] + ".translateY"));
  34. setAttr ($dpad0 + ".translateZ") (getAttr($select[0] + ".translateZ"));
  35.  
  36. // Parent the selected joint under the child pad
  37.  
  38. parent $select[0] $dpad1;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement