reworked and vastly improved snapping subsystem
This commit is contained in:
@@ -25,13 +25,15 @@
|
||||
|
||||
#include "node/output/viewer/viewer.h"
|
||||
#include "timeline/timelinecommon.h"
|
||||
#include "widget/keyframeview/keyframeviewinputconnection.h"
|
||||
#include "widget/resizablescrollbar/resizabletimelinescrollbar.h"
|
||||
#include "widget/timebased/timescaledobject.h"
|
||||
#include "widget/timelinewidget/view/timelineview.h"
|
||||
#include "widget/timeruler/timeruler.h"
|
||||
|
||||
namespace olive {
|
||||
|
||||
class TimeRuler;
|
||||
|
||||
class TimeBasedWidget : public TimelineScaledWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -54,6 +56,22 @@ public:
|
||||
|
||||
virtual bool eventFilter(QObject* object, QEvent* event) override;
|
||||
|
||||
using SnapMask = uint32_t;
|
||||
enum SnapPoints {
|
||||
kSnapToClips = 0x1,
|
||||
kSnapToPlayhead = 0x2,
|
||||
kSnapToMarkers = 0x4,
|
||||
kSnapToKeyframes = 0x8,
|
||||
kSnapAll = UINT32_MAX
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Snaps point `start_point` that is moving by `movement` to currently existing clips
|
||||
*/
|
||||
bool SnapPoint(const std::vector<rational> &start_times, rational *movement, SnapMask snap_points = kSnapAll);
|
||||
void ShowSnaps(const std::vector<rational> ×);
|
||||
void HideSnaps();
|
||||
|
||||
public slots:
|
||||
void SetTime(const rational &time);
|
||||
|
||||
@@ -119,6 +137,10 @@ protected:
|
||||
|
||||
void PassWheelEventsToScrollBar(QObject* object);
|
||||
|
||||
virtual const QVector<Block*> *GetSnapBlocks() const { return nullptr; }
|
||||
virtual const QVector<KeyframeViewInputConnection*> *GetSnapKeyframes() const { return nullptr; }
|
||||
virtual const std::vector<NodeKeyframe*> *GetSnapIgnoreKeyframes() const { return nullptr; }
|
||||
|
||||
protected slots:
|
||||
/**
|
||||
* @brief Slot to center the horizontal scroll bar on the playhead's current position
|
||||
@@ -141,7 +163,7 @@ signals:
|
||||
void ConnectedNodeChanged(ViewerOutput* old, ViewerOutput* now);
|
||||
|
||||
private:
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief Set either in or out point to the current playhead
|
||||
|
||||
Reference in New Issue
Block a user