Advertisement
Guest User

Untitled

a guest
Oct 19th, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. rollout localtransformoffsets "Offset Animation" (
  2. local offsetPos = [0,0,0]
  3. local offsetRot = [0,0,0]
  4. local offsetScale = [0,0,0]
  5. EditText edtPostion "Position" text:"0,0,0"
  6. EditText edtRotation "Rotation" text:"0,0,0"
  7. EditText edtScale "Scale" text:"0,0,0"
  8. Group "Frame Range" (
  9.  
  10. Spinner spStart "Start" type:#integer across:2
  11. Spinner spEnd "End" type:#integer
  12. )
  13.  
  14. Button btnDoIt "Do It"
  15.  
  16. HyperLink hyperWorm "Have a Good Diet of Worms" address:"http://dev.wallworm.com"
  17.  
  18. function doOffsetPositions = (
  19. (offsetPos.x != 0 OR offsetPos.y != 0 OR offsetPos.z != 0)
  20. )
  21. function doOffsetRotations = (
  22. (offsetRot.x != 0 OR offsetRot.y != 0 OR offsetRot.z != 0)
  23. )
  24. function doOffsetScales = (
  25. (offsetScale.x != 0 OR offsetScale.y != 0 OR offsetScale.z != 0)
  26. )
  27.  
  28.  
  29. function offsetAnimation obj frame = (
  30.  
  31. in coordsys local (
  32. if (doOffsetPositions()) then (
  33. at time frame obj.pos += offsetPos
  34. )
  35. if (doOffsetRotations()) then (
  36. at time frame obj.rotation += ((eulerAngles offsetRot.x offsetRot.y offsetRot.z) as quat)
  37. )
  38. if (doOffsetScales()) then (
  39. at time frame obj.scale += offsetScale
  40. )
  41. )
  42. )
  43.  
  44. on btnDoIt pressed do (
  45. if selection.count == 0 then messagebox "Select Something" else (
  46. local doIt = true
  47. if selection.count > 1 then (doIt = queryBox "There are multiple objects selected. You sure about this?")
  48.  
  49. if doIt then (
  50. offsetPosS = filterString edtPostion.text ","
  51. if offsetPosS.count == 3 then (
  52. offsetPos.x = offsetPosS[1] as float
  53. offsetPos.y = offsetPosS[2] as float
  54. offsetPos.z = offsetPosS[3] as float
  55. )
  56.  
  57. offsetRotS = filterString edtRotation.text ","
  58. if offsetRotS.count == 3 then (
  59. offsetRot.x = offsetRotS[1] as float
  60. offsetRot.y = offsetRotS[2] as float
  61. offsetRot.z = offsetRotS[3] as float
  62. )
  63.  
  64. offsetScaleS = filterString edtScale.text ","
  65. if offsetScaleS.count == 3 then (
  66. offsetScale.x = offsetScaleS[1] as float
  67. offsetScale.y = offsetScaleS[2] as float
  68. offsetScale.z = offsetScaleS[3] as float
  69. )
  70. doIt = (doOffsetPositions()) OR ( doOffsetRotations()) OR (doOffsetScales())
  71. if NOT doIt then (
  72. messagebox "Set some offsets."
  73. )
  74. )
  75. if doIt then (
  76. for obj in selection do (
  77. with animate on (
  78. for f = spStart.value to spEnd.value do (
  79. offsetAnimation obj f
  80. )
  81. )
  82. )
  83.  
  84. )
  85. )
  86.  
  87. )
  88.  
  89. )
  90.  
  91. createDialog localtransformoffsets
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement