26 using AnimationResource = std::variant<std::shared_ptr<Animation>, std::shared_ptr<AnimTrack>>;
33 static const std::vector<AnimationComponent*>&
instances() {
return _instances; }
35 void setAnimations(
const std::unordered_map<std::string, AnimationResource>& value);
36 const std::unordered_map<std::string, AnimationResource>&
animations()
const {
return _animations; }
38 void setAssets(
const std::vector<int>& value) { _assets = value; }
39 const std::vector<int>&
assets()
const {
return _assets; }
47 bool loop()
const {
return _loop; }
51 void addAnimation(
const std::string& name,
const std::shared_ptr<Animation>& animation);
52 void addAnimation(
const std::string& name,
const std::shared_ptr<AnimTrack>& animationTrack);
54 void play(
const std::string& name,
float blendTime = 0.0f);
56 std::shared_ptr<Animation>
getAnimation(
const std::string& name)
const;
57 std::shared_ptr<AnimTrack>
getAnimTrack(
const std::string& name)
const;
73 float speed()
const {
return _speed; }
79 void resetAnimationController();
80 void createAnimationController();
81 void stopCurrentAnimation();
83 std::shared_ptr<Animation> getCurrentAnimation()
const;
84 std::shared_ptr<AnimTrack> getCurrentAnimTrack()
const;
86 bool _activate =
true;
88 bool _playing =
false;
90 inline static std::vector<AnimationComponent*> _instances;
92 std::unordered_map<std::string, AnimationResource> _animations;
93 std::vector<int> _assets;
97 std::unique_ptr<AnimEvaluator> _animEvaluator;
101 std::unique_ptr<Skeleton> _skeleton;
102 std::unique_ptr<Skeleton> _fromSkel;
103 std::unique_ptr<Skeleton> _toSkel;
105 std::unordered_map<int, std::string> _animationsIndex;
107 std::string _prevAnim;
108 std::string _currAnim;
111 bool _blending =
false;
112 float _blendSpeed = 0.0f;
114 bool _hasBlendCurve =
false;