Sleeping Wombat Common Library  0.50.0
swCommonLibrary
Animation.h
Go to the documentation of this file.
1 #pragma once
2 
9 
10 #include "IAnimation.h"
12 
13 #include "swCommonLib/ParameterAnimation/Parameters/DirectPropertyh.h"
16 
17 
18 
19 //====================================================================================//
20 // AnimationTyped
21 //====================================================================================//
22 
23 
28 template< typename KeyType >
29 class AnimationTyped : public IAnimation
30 {
31 public:
33 
34 private:
35 protected:
36 public:
37  virtual ~AnimationTyped () = default;
38 
41  virtual bool AddKey ( TimeType time, const KeyType& value ) = 0;
44  virtual bool AddKey ( TimeType time, const KeyType& value, InterpolatorType interpolatorType ) = 0;
47  virtual bool UpdateKey ( TimeType time, const KeyType& newValue, UPtr< Interpolator >&& interpolator ) = 0;
50  virtual bool UpdateKey ( TimeType time, const KeyType& newValue ) = 0;
53  virtual bool RemoveKey ( TimeType time ) = 0;
54 
57  virtual bool ChangeInterpolator ( Size idx, UPtr< Interpolator >&& interpolator ) = 0;
61  virtual bool ChangeInterpolator ( Size idx, InterpolatorType interpolatorType ) = 0;
62 
65  virtual Interpolator* GetInterpolator ( Size idx ) = 0;
66 
68  virtual const Key< KeyType >* GetKey ( TimeType time ) = 0;
69 
71  virtual KeySet< KeyType >& GetKeySet () = 0;
72 };
73 
74 
75 //====================================================================================//
76 // AnimationImpl
77 //====================================================================================//
78 
82 template< typename KeyType, typename AddressType >
83 class AnimationImpl : public AnimationTyped< KeyType >
84 {
85 private:
86 protected:
87 public:
89 
90 public:
91  AnimationImpl ( Object* object, const std::string& propertyPath );
92  virtual ~AnimationImpl () = default;
93 
94 
95  virtual void Animate ( Object* object, TimelineBase* timeline ) override;
96  virtual void Animate ( Object* object, TimeType time ) override;
97 
98 
100  virtual bool AddKey ( TimeType time, const KeyType& value ) override;
102  virtual bool AddKey ( TimeType time, const KeyType& value, InterpolatorType interpolatorType ) override;
104  virtual bool UpdateKey ( TimeType time, const KeyType& newValue, UPtr< Interpolator >&& interpolator ) override;
106  virtual bool UpdateKey ( TimeType time, const KeyType& newValue ) override;
108  virtual bool RemoveKey ( TimeType time ) override;
109 
111  virtual bool ChangeInterpolator ( Size idx, UPtr< Interpolator >&& interpolator ) override;
113  virtual bool ChangeInterpolator ( Size idx, InterpolatorType interpolatorType ) override;
114 
116  virtual Interpolator* GetInterpolator ( Size idx ) override;
118  virtual const Key< KeyType >* GetKey ( TimeType time ) override;
120  virtual KeySet< KeyType >& GetKeySet () override;
121 };
122 
126 
127 template< template< typename KeyType > class AddressType >
129 
130 template< template< typename KeyType > class AddressType >
132 
133 template< template< typename KeyType > class AddressType >
135 
136 #include "Animation.inl"
137 
virtual const Key< KeyType > * GetKey(TimeType time)=0
Return key in given time.
virtual bool AddKey(TimeType time, const KeyType &value) override
Adds key and sets default interpolator.
Definition: Animation.inl:44
Base class for interpolators.
Definition: IInterpolator.h:38
virtual KeySet< KeyType > & GetKeySet()=0
Returns KeySet object.
Base class for timelines.
Definition: TimelineBase.h:26
Interface class for manipulating animation keys.
Definition: Animation.h:29
Definition: UPtr.h:10
virtual bool ChangeInterpolator(Size idx, UPtr< Interpolator > &&interpolator)=0
Updates interpolator. Key remains unchanged.
Evaluates animation.
Definition: AnimEvaluator.h:26
Base animation class.
Definition: IAnimation.h:20
virtual bool RemoveKey(TimeType time)=0
Removes key in given time.
virtual const Key< KeyType > * GetKey(TimeType time) override
Return key in given time.
Definition: Animation.inl:108
virtual Interpolator * GetInterpolator(Size idx) override
Gets interpolator under index. You're not owner of this interpolator.
Definition: Animation.inl:100
virtual bool AddKey(TimeType time, const KeyType &value)=0
Adds key and sets default interpolator.
Animation key.
Definition: IInterpolator.h:21
virtual bool RemoveKey(TimeType time) override
Removes key in given time.
Definition: Animation.inl:76
Set of animation keys and interpolators.
Definition: KeySet.h:25
virtual Interpolator * GetInterpolator(Size idx)=0
Gets interpolator under index. You're not owner of this interpolator.
virtual bool UpdateKey(TimeType time, const KeyType &newValue, UPtr< Interpolator > &&interpolator) override
Adds key and sets default interpolator.
Definition: Animation.inl:60
virtual bool UpdateKey(TimeType time, const KeyType &newValue, UPtr< Interpolator > &&interpolator)=0
Udates key given by time. Sets new interpolator.
Definition: Animation.h:83
Base clas for all objects in sleeping wombat libraries.
Definition: Object.h:42
virtual KeySet< KeyType > & GetKeySet() override
Returns KeySet object.
Definition: Animation.inl:116
virtual bool ChangeInterpolator(Size idx, UPtr< Interpolator > &&interpolator) override
Definition: Animation.inl:84