BoneTrack.lua 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. class "BoneTrack"
  2. function BoneTrack:__getvar(name)
  3. if name == "position" then
  4. local retVal = Polycode.BoneTrack_get_position(self.__ptr)
  5. if retVal == nil then return nil end
  6. local __c = _G["Vector3"]("__skip_ptr__")
  7. __c.__ptr = retVal
  8. return __c
  9. elseif name == "scale" then
  10. local retVal = Polycode.BoneTrack_get_scale(self.__ptr)
  11. if retVal == nil then return nil end
  12. local __c = _G["Vector3"]("__skip_ptr__")
  13. __c.__ptr = retVal
  14. return __c
  15. elseif name == "boneQuat" then
  16. local retVal = Polycode.BoneTrack_get_boneQuat(self.__ptr)
  17. if retVal == nil then return nil end
  18. local __c = _G["Quaternion"]("__skip_ptr__")
  19. __c.__ptr = retVal
  20. return __c
  21. elseif name == "weight" then
  22. return Polycode.BoneTrack_get_weight(self.__ptr)
  23. end
  24. end
  25. function BoneTrack:__setvar(name,value)
  26. if name == "position" then
  27. Polycode.BoneTrack_set_position(self.__ptr, value.__ptr)
  28. return true
  29. elseif name == "scale" then
  30. Polycode.BoneTrack_set_scale(self.__ptr, value.__ptr)
  31. return true
  32. elseif name == "boneQuat" then
  33. Polycode.BoneTrack_set_boneQuat(self.__ptr, value.__ptr)
  34. return true
  35. elseif name == "weight" then
  36. Polycode.BoneTrack_set_weight(self.__ptr, value)
  37. return true
  38. end
  39. return false
  40. end
  41. function BoneTrack:BoneTrack(...)
  42. local arg = {...}
  43. for k,v in pairs(arg) do
  44. if type(v) == "table" then
  45. if v.__ptr ~= nil then
  46. arg[k] = v.__ptr
  47. end
  48. end
  49. end
  50. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  51. self.__ptr = Polycode.BoneTrack(unpack(arg))
  52. end
  53. end
  54. function BoneTrack:Play(once)
  55. local retVal = Polycode.BoneTrack_Play(self.__ptr, once)
  56. end
  57. function BoneTrack:Stop()
  58. local retVal = Polycode.BoneTrack_Stop(self.__ptr)
  59. end
  60. function BoneTrack:Update(elapsed)
  61. local retVal = Polycode.BoneTrack_Update(self.__ptr, elapsed)
  62. end
  63. function BoneTrack:Reset()
  64. local retVal = Polycode.BoneTrack_Reset(self.__ptr)
  65. end
  66. function BoneTrack:setSpeed(speed)
  67. local retVal = Polycode.BoneTrack_setSpeed(self.__ptr, speed)
  68. end
  69. function BoneTrack:__delete()
  70. if self then Polycode.delete_BoneTrack(self.__ptr) end
  71. end