| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- $#include "Graphics/AnimationController.h"
- struct AnimationControl
- {
- AnimationControl();
- ~AnimationControl();
- String name_ @ name;
- StringHash hash_ @ hash;
- float speed_ @ speed;
- float targetWeight_ @ targetWeight;
- float fadeTime_ @ fadeTime ;
- float autoFadeTime_ @ autoFadeTime;
- bool removeOnCompletion_ @ removeOnCompletion;
- };
- class AnimationController : public Component
- {
- bool Play(const String name, unsigned char layer, bool looped, float fadeInTime = 0.0f);
- bool PlayExclusive(const String name, unsigned char layer, bool looped, float fadeTime = 0.0f);
- bool Stop(const String name, float fadeOutTime = 0.0f);
- void StopLayer(unsigned char layer, float fadeOutTime = 0.0f);
- void StopAll(float fadeTime = 0.0f);
- bool Fade(const String name, float targetWeight, float fadeTime);
- bool FadeOthers(const String name, float targetWeight, float fadeTime);
- bool SetLayer(const String name, unsigned char layer);
- bool SetStartBone(const String name, const String startBoneName);
- bool SetTime(const String name, float time);
- bool SetWeight(const String name, float weight);
- bool SetLooped(const String name, bool enable);
- bool SetBlendMode(const String name, AnimationBlendMode mode);
- bool SetSpeed(const String name, float speed);
- bool SetAutoFade(const String name, float fadeOutTime);
- bool SetRemoveOnCompletion(const String name, bool removeOnCompletion);
- bool IsPlaying(const String name) const;
- bool IsPlaying(unsigned char layer) const;
- bool IsFadingIn(const String name) const;
- bool IsFadingOut(const String name) const;
- bool IsAtEnd(const String name) const;
- unsigned char GetLayer(const String name) const;
- Bone* GetStartBone(const String name) const;
- const String GetStartBoneName(const String name) const;
- float GetTime(const String name) const;
- float GetWeight(const String name) const;
- bool IsLooped(const String name) const;
- AnimationBlendMode GetBlendMode(const String name) const;
- float GetLength(const String name) const;
- float GetSpeed(const String name) const;
- float GetFadeTarget(const String name) const;
- float GetFadeTime(const String name) const;
- float GetAutoFade(const String name) const;
- bool GetRemoveOnCompletion(const String name) const;
- AnimationState* GetAnimationState(const String name) const;
- AnimationState* GetAnimationState(StringHash nameHash) const;
- tolua_outside const AnimationControl* AnimationControllerGetAnimation @ GetAnimation(unsigned index) const;
- tolua_outside unsigned AnimationControllerGetNumAnimations @ GetNumAnimations() const;
- };
- ${
- static const AnimationControl* AnimationControllerGetAnimation(const AnimationController* controller, unsigned index)
- {
- if (!controller)
- return (const AnimationControl*)0;
- const Vector<AnimationControl>& animations = controller->GetAnimations();
- return (index < animations.Size()) ? &animations[index] : (const AnimationControl*)0;
- }
- static unsigned AnimationControllerGetNumAnimations(const AnimationController* controller)
- {
- if (!controller)
- return 0;
- return controller->GetAnimations().Size();
- }
- $}
|