AnimationController.pkg 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. $#include "AnimationController.h"
  2. /// %Component that drives an AnimatedModel's animations.
  3. class AnimationController : public Component
  4. {
  5. public:
  6. /// Play an animation and set full target weight. Name must be the full resource name. Return true on success.
  7. bool Play(const char* name, unsigned char layer, bool looped);
  8. bool Play(const char* name, unsigned char layer, bool looped, float fadeInTime = 0.0f);
  9. /// Play an animation, set full target weight and fade out all other animations on the same layer. Name must be the full resource name. Return true on success.
  10. bool PlayExclusive(const char* name, unsigned char layer, bool looped);
  11. bool PlayExclusive(const char* name, unsigned char layer, bool looped, float fadeTime = 0.0f);
  12. /// Stop an animation. Zero fadetime is instant. Return true on success.
  13. bool Stop(const char* name);
  14. bool Stop(const char* name, float fadeOutTime = 0.0f);
  15. /// Stop all animations on a specific layer. Zero fadetime is instant.
  16. void StopLayer(unsigned char layer);
  17. void StopLayer(unsigned char layer, float fadeOutTime = 0.0f);
  18. /// Stop all animations. Zero fadetime is instant.
  19. void StopAll();
  20. void StopAll(float fadeTime = 0.0f);
  21. /// Fade animation to target weight. Return true on success.
  22. bool Fade(const char* name, float targetWeight, float fadeTime);
  23. /// Fade other animations on the same layer to target weight. Return true on success.
  24. bool FadeOthers(const char* name, float targetWeight, float fadeTime);
  25. /// Set animation blending layer priority. Return true on success.
  26. bool SetLayer(const char* name, unsigned char layer);
  27. /// Set animation start bone. Return true on success.
  28. bool SetStartBone(const char* name, const char* startBoneName);
  29. /// Set animation time position. Return true on success.
  30. bool SetTime(const char* name, float time);
  31. /// Set animation weight. Return true on success.
  32. bool SetWeight(const char* name, float weight);
  33. /// Set animation looping. Return true on success.
  34. bool SetLooped(const char* name, bool enable);
  35. /// Set animation speed. Return true on success.
  36. bool SetSpeed(const char* name, float speed);
  37. /// Set animation autofade on stop (non-looped animations only.) Zero time disables. Return true on success.
  38. bool SetAutoFade(const char* name, float fadeOutTime);
  39. /// Return whether an animation is active.
  40. bool IsPlaying(const char* name) const;
  41. /// Return whether an animation is fading in.
  42. bool IsFadingIn(const char* name) const;
  43. /// Return whether an animation is fading out.
  44. bool IsFadingOut(const char* name) const;
  45. /// Return animation blending layer.
  46. unsigned char GetLayer(const char* name) const;
  47. /// Return animation start bone, or null if no such animation.
  48. Bone* GetStartBone(const char* name) const;
  49. /// Return animation start bone name, or empty string if no such animation.
  50. const String& GetStartBoneName(const char* name) const;
  51. /// Return animation time position.
  52. float GetTime(const char* name) const;
  53. /// Return animation weight.
  54. float GetWeight(const char* name) const;
  55. /// Return animation looping.
  56. bool IsLooped(const char* name) const;
  57. /// Return animation length.
  58. float GetLength(const char* name) const;
  59. /// Return animation speed.
  60. float GetSpeed(const char* name) const;
  61. /// Return animation fade target weight.
  62. float GetFadeTarget(const char* name) const;
  63. /// Return animation fade time.
  64. float GetFadeTime(const char* name) const;
  65. /// Return animation autofade time.
  66. float GetAutoFade(const char* name) const;
  67. };