Radium Engine  1.5.0
Timeline.hpp
1 #pragma once
2 
3 #include <Gui/RaGui.hpp>
4 
5 #include <Core/Animation/KeyFramedValue.hpp>
6 #include <Core/Animation/KeyFramedValueController.hpp>
7 #include <Engine/Scene/ItemEntry.hpp>
8 
9 #include <QDialog>
10 #include <QObject>
11 
12 namespace Ui {
13 class Timeline;
14 }
15 
16 namespace Ra::Gui {
17 
37 class RA_GUI_API Timeline : public QDialog
38 {
39  Q_OBJECT
40 
41  public:
42  explicit Timeline( QWidget* parent = nullptr );
43  ~Timeline();
44 
45  public:
49  void selectionChanged( const Ra::Engine::Scene::ItemEntry& ent );
50 
54  void registerKeyFramedValue(
56  const Ra::Core::Animation::KeyFramedValueController& keyFramedValueController );
57 
61  void unregisterKeyFramedValue( Ra::Engine::Scene::Entity* ent, const std::string& name );
62 
66  void registerKeyFramedValue(
68  const Ra::Core::Animation::KeyFramedValueController& keyFramedValueController );
69 
73  void unregisterKeyFramedValue( Ra::Engine::Scene::Component* comp, const std::string& name );
74 
78  void registerKeyFramedValue(
79  Ra::Core::Utils::Index roIdx,
80  const Ra::Core::Animation::KeyFramedValueController& keyFramedValueController );
81 
85  void unregisterKeyFramedValue( Ra::Core::Utils::Index roIdx, const std::string& name );
86 
90  Scalar getTime() const;
91 
95  void detachFromEngine();
96 
97  signals:
102  void startChanged( Scalar time );
103 
108  void endChanged( Scalar time );
109 
114  void cursorChanged( Scalar time );
115 
120  void durationChanged( Scalar time );
121 
125  void playClicked( bool play );
126 
130  void setPingPong( bool );
131 
137  void keyFrameAdded( Scalar time );
138 
143  void keyFrameDeleted( size_t i );
144 
149  void keyFrameChanged( size_t i );
150 
156  void keyFrameMoved( size_t i, Scalar time1 );
157 
163  void keyFramesMoved( size_t first, Scalar offset );
164 
165  public slots:
170  void onChangeStart( Scalar time );
171 
176  void onChangeEnd( Scalar time );
177 
182  void onChangeDuration( Scalar time );
183 
188  void onChangeCursor( Scalar time );
189 
193  void onSetPlay( bool play ); // use it if external play button
194 
195  protected:
196  void resizeEvent( QResizeEvent* ev ) override;
197 
198  private slots:
202  void on_pingPong_toggled( bool checked );
203 
207  void updateKeyFrames( Scalar time );
208 
212  void onClearKeyFrames();
213 
217  void onAddingKeyFrame( Scalar time );
218 
222  void onRemovingKeyFrame( size_t i );
223 
227  void onChangingKeyFrame( size_t i );
228 
232  void onMovingKeyFrame( size_t i, Scalar time1 );
233 
237  void onMovingKeyFrames( size_t first, Scalar offset );
238 
242  void on_comboBox_attribute_currentTextChanged( const QString& arg1 );
243 
247  void on_pushButton_editAttribute_clicked();
248 
252  void on_toolButton_help_clicked();
253 
254  private:
256  Ui::Timeline* ui;
257 
259  std::map<Ra::Engine::Scene::Entity*, std::vector<Ra::Core::Animation::KeyFramedValueController>>
260  m_entityKeyFrames;
261 
264  std::vector<Ra::Core::Animation::KeyFramedValueController>>
265  m_componentKeyFrames;
266 
268  std::map<Ra::Core::Utils::Index, std::vector<Ra::Core::Animation::KeyFramedValueController>>
269  m_renderObjectKeyFrames;
270 
273 
276  int m_entityAddObserverId { -1 };
277  int m_entityRemoveObserverId { -1 };
278  int m_roAddObserverId { -1 };
280 };
281 
282 } // namespace Ra::Gui
A component is an element that can be updated by a system. It is also linked to some other components...
Definition: Component.hpp:31
An entity is an scene element. It ties together components with a transform.
Definition: Entity.hpp:23
The Timeline class provides display and management of time, as well as keyframes.
Definition: Timeline.hpp:38
void playClicked(bool play)
playClicked is emitted when user click on play button.
void keyFrameChanged(size_t i)
keyFrameChanged is emitted when user insert keyFrame in a known keyFrame position.
void setPingPong(bool)
setPingPong is emitted when user click on PingPong button.
void keyFrameAdded(Scalar time)
keyFrameAdded is emitted when user add new keyFrame.
void startChanged(Scalar time)
startChanged is emitted when user move left slider of playzone or set new value in start spin (green)
void durationChanged(Scalar time)
durationChanged is emitted when user change duration time in top right spin.
void keyFrameMoved(size_t i, Scalar time1)
keyFrameMoved is emitted when user move the keyFrame on cursor to a new position (on mouse)
void keyFrameDeleted(size_t i)
keyFrameDeleted is emitted when user remove keyFrame.
void endChanged(Scalar time)
endChanged is emitted when user move right slider of playzone or set new value in end spin (red)
void cursorChanged(Scalar time)
cursorChanged is emitted when user move cursor.
void keyFramesMoved(size_t first, Scalar offset)
keyFramesMoved is emitted when user move keyFrames.