implemented bulk of curve editor's functionality

While certainly not entirely complete yet, this implements most of the UI
functionality of the graph editor.
This commit is contained in:
itsmattkc
2019-12-28 18:26:37 +11:00
parent b65abe4881
commit 26cafa7936
21 changed files with 603 additions and 36 deletions
+32
View File
@@ -1,6 +1,8 @@
#ifndef CURVEVIEW_H
#define CURVEVIEW_H
#include "node/keyframe.h"
#include "widget/keyframeview/keyframeviewitem.h"
#include "widget/timelinewidget/view/timelineviewbase.h"
class CurveView : public TimelineViewBase
@@ -8,12 +10,42 @@ class CurveView : public TimelineViewBase
public:
CurveView(QWidget* parent = nullptr);
void Clear();
void SetXScale(const double& x_scale);
void SetYScale(const double& y_scale);
public slots:
void AddKeyframe(NodeKeyframePtr key);
void RemoveKeyframe(NodeKeyframePtr key);
protected:
virtual void drawBackground(QPainter* painter, const QRectF& rect) override;
private:
QList<NodeKeyframe*> GetKeyframesSortedByTime();
qreal GetItemYFromKeyframeValue(NodeKeyframe* key);
void SetItemYFromKeyframeValue(NodeKeyframe* key, KeyframeViewItem* item);
void AdjustLines();
int text_padding_;
double y_scale_;
int minimum_grid_space_;
QMap<NodeKeyframe*, KeyframeViewItem*> key_item_map_;
QList<QGraphicsLineItem*> lines_;
private slots:
void KeyframeValueChanged();
};
#endif // CURVEVIEW_H