X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Frotoscoping%2Frotowidget.h;h=f3e8d9bd4c2d7dfd15ddc282960e0196be7c8fb2;hb=3c844989ad9fdb96bb9258a990a9874773b3d792;hp=dc385f673e062c4cc7fedf0b9f3b14a03726b15d;hpb=1358c7644913c58cfca2b97c3dff9a2d165b7894;p=kdenlive diff --git a/src/rotoscoping/rotowidget.h b/src/rotoscoping/rotowidget.h index dc385f67..f3e8d9bd 100644 --- a/src/rotoscoping/rotowidget.h +++ b/src/rotoscoping/rotowidget.h @@ -19,7 +19,8 @@ #ifndef ROTOWIDGET_H #define ROTOWIDGET_H -#include "bpoint.h" +#include "definitions.h" +#include "beziercurve/bpoint.h" #include "timecode.h" #include @@ -28,27 +29,37 @@ class Monitor; class MonitorScene; class SplineItem; class SimpleKeyframeWidget; +namespace Mlt +{ +class Filter; +} + +/** @brief Adjusts keyframes after resizing a clip. */ +bool adjustRotoDuration(QString *data, int in, int out); class RotoWidget : public QWidget { Q_OBJECT public: - RotoWidget(QString data, Monitor *monitor, int in, int out, Timecode t, QWidget* parent = 0); - virtual ~RotoWidget(); + RotoWidget(const QString &data, Monitor *monitor, const ItemInfo &info, const Timecode &t, QWidget* parent = 0); + ~RotoWidget(); + /** @brief Returns the spline(s) in the JSON format used by filter_rotoscoping (MLT). */ QString getSpline(); + + /** @brief Replaces current data with \param spline (JSON). */ + void setSpline(const QString &spline, bool notify = true); + + /** @brief Passed on to the keyframe timeline. Switches between frames and hh:mm:ss:ff timecode. */ void updateTimecodeFormat(); public slots: - /** @brief Switches from normal monitor to monitor scene according to @param show. */ - void slotShowScene(bool show = true); /** @brief Updates the on-monitor item. */ void slotSyncPosition(int relTimelinePos); signals: void valueChanged(); - void checkMonitorPosition(int); void seekToPos(int pos); @@ -61,17 +72,28 @@ private: SplineItem *m_item; int m_in; int m_out; + Mlt::Filter *m_filter; + /** @brief Returns the list of cubic Bézier points that form the spline at position @param keyframe. + * The points are brought from the range [0, 1] into project resolution space. + * This function does not do any interpolation and therfore will only return a list when a keyframe at the given postion exists. + * Set @param keyframe to -1 if only one keyframe currently exists. */ QList getPoints(int keyframe); + /** @brief Adds tracking_finished as listener for "tracking-finished" event in MLT rotoscoping filter. */ + void setupTrackingListen(const ItemInfo &info); + + /** @brief Passes list of keyframe positions to keyframe timeline widget. */ + void keyframeTimelineFullUpdate(); + private slots: - /** @brief Makes sure the monitor effect scene is only visible if the clip this geometry belongs to is visible. - * @param renderPos Postion of the Monitor / Timeline cursor */ - void slotCheckMonitorPosition(int renderPos); + /** @brief Updates/Creates the spline at @param pos based on the on-monitor items. */ void slotUpdateData(int pos = -1, bool editing = false); + /** @brief Updates/Creates the spline at the current timeline position based on the on-monitor items. */ void slotUpdateData(bool editing); + /** @brief Updates the on-monitor items to fit the spline at position @param pos. */ void slotPositionChanged(int pos, bool seek = true); void slotAddKeyframe(int pos = -1);