AnimationController.pkg 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 String& name, unsigned char layer, bool looped, float fadeInTime = 0.0f);
  8. /// 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.
  9. bool PlayExclusive(const String& name, unsigned char layer, bool looped, float fadeTime = 0.0f);
  10. /// Stop an animation. Zero fadetime is instant. Return true on success.
  11. bool Stop(const String& name, float fadeOutTime = 0.0f);
  12. /// Stop all animations on a specific layer. Zero fadetime is instant.
  13. void StopLayer(unsigned char layer, float fadeOutTime = 0.0f);
  14. /// Stop all animations. Zero fadetime is instant.
  15. void StopAll(float fadeTime = 0.0f);
  16. /// Fade animation to target weight. Return true on success.
  17. bool Fade(const String& name, float targetWeight, float fadeTime);
  18. /// Fade other animations on the same layer to target weight. Return true on success.
  19. bool FadeOthers(const String& name, float targetWeight, float fadeTime);
  20. /// Set animation blending layer priority. Return true on success.
  21. bool SetLayer(const String& name, unsigned char layer);
  22. /// Set animation start bone. Return true on success.
  23. bool SetStartBone(const String& name, const String& startBoneName);
  24. /// Set animation time position. Return true on success.
  25. bool SetTime(const String& name, float time);
  26. /// Set animation weight. Return true on success.
  27. bool SetWeight(const String& name, float weight);
  28. /// Set animation looping. Return true on success.
  29. bool SetLooped(const String& name, bool enable);
  30. /// Set animation speed. Return true on success.
  31. bool SetSpeed(const String& name, float speed);
  32. /// Set animation autofade on stop (non-looped animations only.) Zero time disables. Return true on success.
  33. bool SetAutoFade(const String& name, float fadeOutTime);
  34. /// Return whether an animation is active.
  35. bool IsPlaying(const String& name) const;
  36. /// Return whether an animation is fading in.
  37. bool IsFadingIn(const String& name) const;
  38. /// Return whether an animation is fading out.
  39. bool IsFadingOut(const String& name) const;
  40. /// Return animation blending layer.
  41. unsigned char GetLayer(const String& name) const;
  42. /// Return animation start bone, or null if no such animation.
  43. Bone* GetStartBone(const String& name) const;
  44. /// Return animation start bone name, or empty string if no such animation.
  45. const String& GetStartBoneName(const String& name) const;
  46. /// Return animation time position.
  47. float GetTime(const String& name) const;
  48. /// Return animation weight.
  49. float GetWeight(const String& name) const;
  50. /// Return animation looping.
  51. bool IsLooped(const String& name) const;
  52. /// Return animation length.
  53. float GetLength(const String& name) const;
  54. /// Return animation speed.
  55. float GetSpeed(const String& name) const;
  56. /// Return animation fade target weight.
  57. float GetFadeTarget(const String& name) const;
  58. /// Return animation fade time.
  59. float GetFadeTime(const String& name) const;
  60. /// Return animation autofade time.
  61. float GetAutoFade(const String& name) const;
  62. };