Advertisement
zzz7net

MEL IKFK matching code for Maya rig

Jan 10th, 2015
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.10 KB | None | 0 0
  1. //fk 2 ik
  2. string $shoulderCON[] = `listConnections #.shoulderCON`;
  3. string $elbowCON[] = `listConnections #.elbowCON`;
  4. string $wristCON[] = `listConnections #.wristCON`;
  5. string $shoulderJoint[] = `listConnections #.shoulderJoint`;
  6. string $elbowJoint[] = `listConnections #.elbowJoint`;
  7. string $wristJoint[] = `listConnections #.wristJoint`;
  8. string $armCON[] = `listConnections #.armCON`;
  9. int $time = `currentTime -q`;
  10. currentTime -edit ($time - 1);
  11. setKeyframe ($shoulderCON[0] + ".rotate");
  12. setKeyframe ($elbowCON[0] + ".rotate");
  13. setKeyframe ($wristCON[0] + ".rotate");
  14. setKeyframe ($armCON[0] + ".ik");
  15. currentTime -edit $time;
  16. float $shoulder[] = `xform -q -ws -ro $shoulderJoint[0]`;
  17. float $elbow[] = `xform -q -ws -ro $elbowJoint[0]`;
  18. float $wrist[] = `xform -q -ws -ro $armCON[0]`;
  19. xform -ws -ro $shoulder[0] $shoulder[1] $shoulder[2] $shoulderCON[0];
  20. xform -ws -ro $elbow[0] $elbow[1] $elbow[2] $elbowCON[0];
  21. xform -ws -ro $wrist[0] $wrist[1] $wrist[2] $wristCON[0];
  22. setKeyframe ($shoulderCON[0] + ".rotate");
  23. setKeyframe ($elbowCON[0] + ".rotate");
  24. setKeyframe ($wristCON[0] + ".rotate");
  25. setKeyframe ($armCON[0] + ".ik");
  26.  
  27. //ik 2 fk
  28. string $shoulderJoint[] = `listConnections #.shoulderJoint`;
  29. string $wristCON[] = `listConnections #.wristCON`;
  30. string $armCON[] = `listConnections #.armCON`;
  31. string $poleCON[] = `listConnections #.poleCON`;
  32. string $PV_LOC[] = `listConnections #.PV_LOC`;
  33. int $time = `currentTime -q`;
  34. currentTime -edit ($time - 1);
  35. setKeyframe ($armCON[0] + ".translate");
  36. setKeyframe ($poleCON[0] + ".translate");
  37. setKeyframe ($armCON[0] + ".ik");
  38. currentTime -edit $time;
  39. float $fkPOVLoc[] = `xform -q -ws -t $PV_LOC[0]`;
  40. float $wristRot[] = `xform -q -ws -ro $wristCON[0]`;
  41. float $wristPos[] = `xform -q -ws -t $wristCON[0]`;
  42. xform -ws -t $wristPos[0] $wristPos[1] $wristPos[2] $armCON[0];
  43. xform -ws -ro $wristRot[0] $wristRot[1] $wristRot[2] $armCON[0];
  44. xform -ws -t $fkPOVLoc[0] $fkPOVLoc[1] $fkPOVLoc[2] $poleCON[0];
  45. setKeyframe ($armCON[0] + ".translate");
  46. setKeyframe ($armCON[0] + ".rotate");
  47. setKeyframe ($poleCON[0] + ".translate");
  48. setKeyframe ($armCON[0] + ".ik");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement