cwisbg

CRV from Transform

May 13th, 2019
433
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. # CRV from Transform
  2. from pymel.core import*
  3. import random as r
  4. sl = selected()
  5. for s in sl:
  6. p = str(s)
  7. ex = "vector $pos = <<"+p+".translateX,"+p+".translateY,"+p+".translateZ>>;"+"\n"
  8. ex += "string $curveName ="
  9. ex += "\""+p+"_MotionCrv\";"
  10. ex += "\n"
  11. ex += "if(frame == 2){"
  12. ex += "\n"
  13. ex += "int $objTest = `objExists $curveName`;"
  14. ex += "\n"
  15. ex += "if ($objTest == 1)"
  16. ex += "\n"
  17. ex += "{"+"\n"
  18. ex += "delete $curveName;"
  19. ex += "\n"
  20. ex += "}"+"\n"
  21. ex += "curve -p ($pos.x) ($pos.y) ($pos.z) -n $curveName;"
  22. ex += "\n"
  23. ex += "}"
  24. ex += "\n"
  25. ex += "if(frame >= 3)"
  26. ex += "\n"
  27. ex += "{"
  28. ex += "\n"
  29. ex += "curve -append -p ($pos.x) ($pos.y) ($pos.z) $curveName;"
  30. ex += "\n"
  31. ex += "}"+"\n"
  32. expression(s, s = ex, n = s+"_Crv_Expression")
Advertisement
Add Comment
Please, Sign In to add comment