|
VisuTwin Canvas
C++ 3D Engine — Metal Backend
|
#include <framework/components/animation/animationComponent.h>
Public Types | |
| using | AnimationResource = std::variant<std::shared_ptr<Animation>, std::shared_ptr<AnimTrack>> |
Public Member Functions | |
| bool | activate () const |
| void | addAnimation (const std::string &name, const std::shared_ptr< Animation > &animation) |
| void | addAnimation (const std::string &name, const std::shared_ptr< AnimTrack > &animationTrack) |
| AnimationComponent (IComponentSystem *system, Entity *entity) | |
| const std::unordered_map< std::string, AnimationResource > & | animations () const |
| const std::vector< int > & | assets () const |
| void | clearBlendCurve () |
| float | currentTime () const |
| float | duration () const |
| std::shared_ptr< Animation > | getAnimation (const std::string &name) const |
| std::shared_ptr< AnimTrack > | getAnimTrack (const std::string &name) const |
| void | initializeComponentData () override |
| bool | loop () const |
| void | onBeforeRemove () |
| void | onEnable () override |
| void | onSetAnimations () |
| void | play (const std::string &name, float blendTime=0.0f) |
| bool | playing () const |
| void | setActivate (bool value) |
| void | setAnimations (const std::unordered_map< std::string, AnimationResource > &value) |
| void | setAssets (const std::vector< int > &value) |
| void | setBlendCurve (const Curve &curve) |
| void | setCurrentTime (float currentTime) |
| void | setLoop (bool value) |
| void | setModel (GraphNode *model) |
| void | setPlaying (bool value) |
| void | setSpeed (float value) |
| float | speed () const |
| void | update (float dt) |
| ~AnimationComponent () override | |
| Public Member Functions inherited from visutwin::canvas::Component | |
| virtual void | cloneFrom (const Component *source) |
| Component (IComponentSystem *system, Entity *entity) | |
| virtual bool | enabled () const |
| Entity * | entity () const |
| virtual void | onDisable () |
| virtual void | onPostStateChange () |
| virtual void | setEnabled (bool value) |
| IComponentSystem * | system () const |
| virtual | ~Component ()=default |
| Public Member Functions inherited from visutwin::canvas::EventHandler | |
| template<typename... Args> | |
| EventHandler * | fire (const std::string &name, Args &&... args) |
| bool | hasEvent (const std::string &name) const |
| void | initEventHandler () |
| template<typename Callback> requires (!std::is_same_v<std::decay_t<Callback>, HandleEventCallback>) | |
| EventHandler * | off (const std::string &name, Callback &&callback, void *scope=nullptr) |
| EventHandler * | off (const std::string &name="", const HandleEventCallback &callback=HandleEventCallback(), void *scope=nullptr) |
| EventHandler * | offByHandle (EventHandle *handle) |
| template<typename Callback> requires (!std::is_same_v<std::decay_t<Callback>, HandleEventCallback>) | |
| EventHandle * | on (const std::string &name, Callback &&callback, void *scope=nullptr) |
| EventHandle * | on (const std::string &name, HandleEventCallback callback, void *scope=nullptr) |
| template<typename Callback> requires (!std::is_same_v<std::decay_t<Callback>, HandleEventCallback>) | |
| EventHandle * | once (const std::string &name, Callback &&callback, void *scope=nullptr) |
| EventHandle * | once (const std::string &name, HandleEventCallback callback, void *scope=nullptr) |
| virtual | ~EventHandler ()=default |
Static Public Member Functions | |
| static const std::vector< AnimationComponent * > & | instances () |
Additional Inherited Members | |
| Protected Member Functions inherited from visutwin::canvas::Component | |
| virtual void | onSetEnabled (bool oldValue, bool newValue) |
| Protected Member Functions inherited from visutwin::canvas::EventHandler | |
| EventHandle * | addCallback (const std::string &name, HandleEventCallback callback, void *scope=nullptr, bool once=false) |
| Protected Attributes inherited from visutwin::canvas::Component | |
| bool | _enabled = true |
| Entity * | _entity |
Definition at line 23 of file animationComponent.h.
| using visutwin::canvas::AnimationComponent::AnimationResource = std::variant<std::shared_ptr<Animation>, std::shared_ptr<AnimTrack>> |
Definition at line 26 of file animationComponent.h.
| visutwin::canvas::AnimationComponent::AnimationComponent | ( | IComponentSystem * | system, |
| Entity * | entity ) |
Definition at line 12 of file animationComponent.cpp.
References visutwin::canvas::Component::Component(), visutwin::canvas::Component::entity(), and visutwin::canvas::Component::system().
|
override |
Definition at line 18 of file animationComponent.cpp.
|
inline |
Definition at line 70 of file animationComponent.h.
| void visutwin::canvas::AnimationComponent::addAnimation | ( | const std::string & | name, |
| const std::shared_ptr< Animation > & | animation ) |
Definition at line 32 of file animationComponent.cpp.
References onSetAnimations().
| void visutwin::canvas::AnimationComponent::addAnimation | ( | const std::string & | name, |
| const std::shared_ptr< AnimTrack > & | animationTrack ) |
Definition at line 38 of file animationComponent.cpp.
References onSetAnimations().
|
inline |
Definition at line 36 of file animationComponent.h.
|
inline |
Definition at line 39 of file animationComponent.h.
| void visutwin::canvas::AnimationComponent::clearBlendCurve | ( | ) |
Definition at line 381 of file animationComponent.cpp.
| float visutwin::canvas::AnimationComponent::currentTime | ( | ) | const |
Definition at line 59 of file animationComponent.cpp.
Referenced by setCurrentTime(), and update().
| float visutwin::canvas::AnimationComponent::duration | ( | ) | const |
Definition at line 75 of file animationComponent.cpp.
Referenced by update().
| std::shared_ptr< Animation > visutwin::canvas::AnimationComponent::getAnimation | ( | const std::string & | name | ) | const |
Definition at line 124 of file animationComponent.cpp.
References visutwin::canvas::GraphNode::find().
Referenced by play().
| std::shared_ptr< AnimTrack > visutwin::canvas::AnimationComponent::getAnimTrack | ( | const std::string & | name | ) | const |
Definition at line 138 of file animationComponent.cpp.
Referenced by play().
|
inlineoverridevirtual |
Implements visutwin::canvas::Component.
Definition at line 31 of file animationComponent.h.
|
inlinestatic |
Definition at line 33 of file animationComponent.h.
|
inline |
Definition at line 47 of file animationComponent.h.
| void visutwin::canvas::AnimationComponent::onBeforeRemove | ( | ) |
Definition at line 301 of file animationComponent.cpp.
|
overridevirtual |
Reimplemented from visutwin::canvas::Component.
Definition at line 292 of file animationComponent.cpp.
References visutwin::canvas::Component::onEnable(), and play().
| void visutwin::canvas::AnimationComponent::onSetAnimations | ( | ) |
Definition at line 224 of file animationComponent.cpp.
References visutwin::canvas::Component::_entity, visutwin::canvas::Component::enabled(), play(), and setModel().
Referenced by addAnimation(), addAnimation(), and setAnimations().
| void visutwin::canvas::AnimationComponent::play | ( | const std::string & | name, |
| float | blendTime = 0.0f ) |
Definition at line 162 of file animationComponent.cpp.
References visutwin::canvas::Component::_entity, visutwin::canvas::Component::enabled(), getAnimation(), and getAnimTrack().
Referenced by onEnable(), onSetAnimations(), and setModel().
|
inline |
Definition at line 76 of file animationComponent.h.
|
inline |
Definition at line 69 of file animationComponent.h.
| void visutwin::canvas::AnimationComponent::setAnimations | ( | const std::unordered_map< std::string, AnimationResource > & | value | ) |
Definition at line 26 of file animationComponent.cpp.
References onSetAnimations().
|
inline |
Definition at line 38 of file animationComponent.h.
| void visutwin::canvas::AnimationComponent::setBlendCurve | ( | const Curve & | curve | ) |
Definition at line 375 of file animationComponent.cpp.
| void visutwin::canvas::AnimationComponent::setCurrentTime | ( | float | currentTime | ) |
Definition at line 44 of file animationComponent.cpp.
References currentTime().
| void visutwin::canvas::AnimationComponent::setLoop | ( | bool | value | ) |
Definition at line 93 of file animationComponent.cpp.
| void visutwin::canvas::AnimationComponent::setModel | ( | GraphNode * | model | ) |
Definition at line 110 of file animationComponent.cpp.
References play().
Referenced by onSetAnimations().
|
inline |
Definition at line 75 of file animationComponent.h.
|
inline |
Definition at line 72 of file animationComponent.h.
|
inline |
Definition at line 73 of file animationComponent.h.
| void visutwin::canvas::AnimationComponent::update | ( | float | dt | ) |
Definition at line 310 of file animationComponent.cpp.
References currentTime(), and duration().