From b6a63f517f9c93311bd5b119d6c30a85cca7edc4 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Mon, 5 Nov 2012 00:30:22 +0100 Subject: [PATCH] Improve update of effect stack when resizing clip, start implementing merge of analysis data --- effects/automask.xml | 2 +- src/abstractclipitem.cpp | 18 +++++++-- src/abstractclipitem.h | 11 +++++- src/clipitem.cpp | 20 +++------- src/clipitem.h | 12 ++---- src/cornerswidget.cpp | 1 + src/customtrackview.cpp | 11 ++++-- src/docclipbase.cpp | 53 ++++++++++++++++++++++---- src/docclipbase.h | 4 +- src/effectstack/collapsibleeffect.cpp | 5 ++- src/effectstack/collapsibleeffect.h | 2 + src/effectstack/effectstackview2.cpp | 12 ++++++ src/effectstack/effectstackview2.h | 4 ++ src/effectstack/parametercontainer.cpp | 25 +++++++++++- src/effectstack/parametercontainer.h | 4 ++ src/geometryval.cpp | 7 +++- src/geometryval.h | 1 + src/geometrywidget.cpp | 14 ++++++- src/geometrywidget.h | 2 + src/keyframeedit.cpp | 6 +++ src/keyframeedit.h | 4 ++ src/positionedit.h | 4 +- src/projectlist.cpp | 2 +- 23 files changed, 174 insertions(+), 50 deletions(-) diff --git a/effects/automask.xml b/effects/automask.xml index ae68503a..7651d394 100644 --- a/effects/automask.xml +++ b/effects/automask.xml @@ -27,7 +27,7 @@ Obscure - + motion_vector_list diff --git a/src/abstractclipitem.cpp b/src/abstractclipitem.cpp index 1a0adfd0..713bbcfb 100644 --- a/src/abstractclipitem.cpp +++ b/src/abstractclipitem.cpp @@ -38,7 +38,8 @@ AbstractClipItem::AbstractClipItem(const ItemInfo &info, const QRectF& rect, dou m_selectedKeyframe(0), m_keyframeFactor(1), m_keyframeOffset(0), - m_fps(fps) + m_fps(fps), + m_isMainSelectedClip(false) { setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable); #if QT_VERSION >= 0x040600 @@ -126,7 +127,7 @@ void AbstractClipItem::updateRectGeometry() setRect(0, 0, cropDuration().frames(m_fps) - 0.02, rect().height()); } -void AbstractClipItem::resizeStart(int posx, bool hasSizeLimit) +void AbstractClipItem::resizeStart(int posx, bool hasSizeLimit, bool /*emitChange*/) { GenTime durationDiff = GenTime(posx, m_fps) - m_info.startPos; if (durationDiff == GenTime()) return; @@ -189,7 +190,7 @@ void AbstractClipItem::resizeStart(int posx, bool hasSizeLimit) }*/ } -void AbstractClipItem::resizeEnd(int posx) +void AbstractClipItem::resizeEnd(int posx, bool /*emitChange*/) { GenTime durationDiff = GenTime(posx, m_fps) - endPos(); if (durationDiff == GenTime()) return; @@ -508,4 +509,15 @@ int AbstractClipItem::itemOffset() return 0; } +void AbstractClipItem::setMainSelectedClip(bool selected) +{ + if (selected == m_isMainSelectedClip) return; + m_isMainSelectedClip = selected; + update(); +} + +bool AbstractClipItem::isMainSelectedClip() +{ + return m_isMainSelectedClip; +} diff --git a/src/abstractclipitem.h b/src/abstractclipitem.h index 1cdcf0cb..3e6a7ad9 100644 --- a/src/abstractclipitem.h +++ b/src/abstractclipitem.h @@ -82,16 +82,21 @@ public: /** @brief Resizes the clip from the start. * @param posx Absolute position of new in point * @param hasSizeLimit (optional) Whether the clip has a maximum size */ - virtual void resizeStart(int posx, bool hasSizeLimit = true); + virtual void resizeStart(int posx, bool hasSizeLimit = true, bool emitChange = true); /** @brief Resizes the clip from the end. * @param posx Absolute position of new out point */ - virtual void resizeEnd(int posx); + virtual void resizeEnd(int posx, bool emitChange = true); virtual double fps() const; virtual void updateFps(double fps); virtual GenTime maxDuration() const; virtual void setCropStart(GenTime pos); + /** @brief Set this clip as the main selected clip (or not). */ + void setMainSelectedClip(bool selected); + /** @brief Is this clip selected as the main clip. */ + bool isMainSelectedClip(); + protected: ItemInfo m_info; /** The position of the current keyframe when it has moved */ @@ -112,6 +117,8 @@ protected: /** The (keyframe) parameter that is visible and editable in timeline (on the clip) */ int m_visibleParam; double m_fps; + /** @brief True if this is the last clip the user selected */ + bool m_isMainSelectedClip; /** @brief Draw the keyframes of a clip * @param painter The painter device for the clip * @param limitedKeyFrames The keyframes can be of type "keyframe" or "simplekeyframe". In the diff --git a/src/clipitem.cpp b/src/clipitem.cpp index 6553c6bd..14389f9a 100644 --- a/src/clipitem.cpp +++ b/src/clipitem.cpp @@ -60,8 +60,7 @@ ClipItem::ClipItem(DocClipBase *clip, ItemInfo info, double fps, double speed, i m_speed(speed), m_strobe(strobe), m_framePixelWidth(0), - m_limitedKeyFrames(false), - m_isMainSelectedClip(false) + m_limitedKeyFrames(false) { setZValue(2); m_effectList = EffectsList(true); @@ -1251,7 +1250,7 @@ void ClipItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *) } */ -void ClipItem::resizeStart(int posx, bool /*size*/) +void ClipItem::resizeStart(int posx, bool /*size*/, bool emitChange) { bool sizeLimit = false; if (clipType() != IMAGE && clipType() != COLOR && clipType() != TEXT) { @@ -1274,9 +1273,10 @@ void ClipItem::resizeStart(int posx, bool /*size*/) m_startThumbTimer.start(150); } } + if (m_isMainSelectedClip && emitChange) emit updateRange(); } -void ClipItem::resizeEnd(int posx) +void ClipItem::resizeEnd(int posx, bool emitChange) { const int max = (startPos() - cropStart() + maxDuration()).frames(m_fps); if (posx > max && maxDuration() != GenTime()) posx = max; @@ -1295,6 +1295,7 @@ void ClipItem::resizeEnd(int posx) m_endThumbTimer.start(150); } } + if (m_isMainSelectedClip && emitChange) emit updateRange(); } //virtual @@ -2087,17 +2088,6 @@ void ClipItem::slotGotThumbsCache() update(); } -void ClipItem::setMainSelectedClip(bool selected) -{ - if (selected == m_isMainSelectedClip) return; - m_isMainSelectedClip = selected; - update(); -} - -bool ClipItem::isMainSelectedClip() -{ - return m_isMainSelectedClip; -} #include "clipitem.moc" diff --git a/src/clipitem.h b/src/clipitem.h index 47434366..7aea4d81 100644 --- a/src/clipitem.h +++ b/src/clipitem.h @@ -52,8 +52,8 @@ public: const QStyleOptionGraphicsItem *option, QWidget *); virtual int type() const; - void resizeStart(int posx, bool size = true); - void resizeEnd(int posx); + void resizeStart(int posx, bool size = true, bool emitChange = true); + void resizeEnd(int posx, bool emitChange = true); OPERATIONTYPE operationMode(QPointF pos); static int itemHeight(); const QString clipProducer() const; @@ -189,10 +189,6 @@ public: /** @brief Get a free index value for effect group. */ int nextFreeEffectGroupIndex() const; - /** @brief Set this clip as the main selected clip (or not). */ - void setMainSelectedClip(bool selected); - /** @brief Is this clip selected as the main clip. */ - bool isMainSelectedClip(); protected: //virtual void mouseMoveEvent(QGraphicsSceneMouseEvent * event); @@ -242,8 +238,6 @@ private: /** @brief Keyframes type can be "keyframe" or "simplekeyframe" which have to be painted differently. * True if keyframe type is "keyframe" */ bool m_limitedKeyFrames; - /** @brief True if this is the last clip the user selected */ - bool m_isMainSelectedClip; private slots: void slotGetStartThumb(); @@ -263,8 +257,8 @@ public slots: void slotSetEndThumb(const QPixmap pix); signals: - void getThumb(int, int); void prepareAudioThumb(double, int, int, int); + void updateRange(); }; #endif diff --git a/src/cornerswidget.cpp b/src/cornerswidget.cpp index f985cf4b..1c2326bf 100644 --- a/src/cornerswidget.cpp +++ b/src/cornerswidget.cpp @@ -246,4 +246,5 @@ void CornersWidget::slotInsertKeyframe() keyframe_list->selectRow(row); } + #include "cornerswidget.moc" diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp index a259b787..2c211f1c 100644 --- a/src/customtrackview.cpp +++ b/src/customtrackview.cpp @@ -450,7 +450,7 @@ void CustomTrackView::mouseMoveEvent(QMouseEvent * event) if (parent) parent->resizeStart((int)(snappedPos - m_dragItemInfo.startPos.frames(m_document->fps()))); } else { - m_dragItem->resizeStart((int)(snappedPos)); + m_dragItem->resizeStart((int)(snappedPos), true, false); } QString crop = m_document->timecode().getDisplayTimecode(m_dragItem->cropStart(), KdenliveSettings::frametimecode()); QString duration = m_document->timecode().getDisplayTimecode(m_dragItem->cropDuration(), KdenliveSettings::frametimecode()); @@ -463,7 +463,7 @@ void CustomTrackView::mouseMoveEvent(QMouseEvent * event) if (parent) parent->resizeEnd((int)(snappedPos - m_dragItemInfo.endPos.frames(m_document->fps()))); } else { - m_dragItem->resizeEnd((int)(snappedPos)); + m_dragItem->resizeEnd((int)(snappedPos), false); } QString duration = m_document->timecode().getDisplayTimecode(m_dragItem->cropDuration(), KdenliveSettings::frametimecode()); QString offset = m_document->timecode().getDisplayTimecode(m_dragItem->cropDuration() - m_dragItemInfo.cropDuration, KdenliveSettings::frametimecode()); @@ -2761,7 +2761,9 @@ void CustomTrackView::adjustTimelineClips(EDITMODE mode, ClipItem *item, ItemInf new RazorClipCommand(this, clipInfo, info.startPos, false, command); new ResizeClipCommand(this, dupInfo, newdupInfo, false, false, command); ClipItem *dup = cutClip(clipInfo, info.startPos, true, false); - if (dup) dup->resizeStart(info.endPos.frames(m_document->fps())); + if (dup) { + dup->resizeStart(info.endPos.frames(m_document->fps())); + } } else { ItemInfo newclipInfo = clip->info(); newclipInfo.endPos = info.startPos; @@ -4872,8 +4874,9 @@ void CustomTrackView::resizeClip(const ItemInfo &start, const ItemInfo &end, boo ItemInfo clipinfo = item->info(); clipinfo.track = m_document->tracksCount() - clipinfo.track; bool success = m_document->renderer()->mltResizeClipStart(clipinfo, end.startPos - clipinfo.startPos); - if (success) + if (success) { item->resizeStart((int) end.startPos.frames(m_document->fps())); + } else emit displayMessage(i18n("Error when resizing clip"), ErrorMessage); } else { diff --git a/src/docclipbase.cpp b/src/docclipbase.cpp index 5f2f01a1..5d41cc04 100644 --- a/src/docclipbase.cpp +++ b/src/docclipbase.cpp @@ -32,12 +32,14 @@ #include #include +#include #include #include #include #include +#include DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, const QString &id) : QObject(), @@ -1276,21 +1278,56 @@ QImage DocClipBase::extractImage(int frame, int width, int height) return m_thumbProd->extractImage(frame, width, height); } -void DocClipBase::setAnalysisData(const QString &name, const QString &data) +void DocClipBase::setAnalysisData(const QString &name, const QString &data, int offset) { if (data.isEmpty()) m_analysisdata.remove(name); else { if (m_analysisdata.contains(name)) { - int i = 1; - QString newname = name + " " + QString::number(i); - while (m_analysisdata.contains(newname)) { - i++; - newname = name + " " + QString::number(i); + if (KMessageBox::questionYesNo(kapp->activeWindow(), i18n("Clip already contains analysis data %1", name), QString(), KGuiItem(i18n("Merge")), KGuiItem(i18n("Add"))) == KMessageBox::Yes) { + // Merge data + Mlt::Profile *profile = m_baseTrackProducers.at(0)->profile(); + Mlt::Geometry geometry(m_analysisdata.value(name).toUtf8().data(), m_properties.value("duration").toInt(), profile->width(), profile->height()); + Mlt::Geometry newGeometry(data.toUtf8().data(), m_properties.value("duration").toInt(), profile->width(), profile->height()); + Mlt::GeometryItem item; + int pos = 0; + while (!newGeometry.next_key(&item, pos)) { + pos = item.frame(); + item.frame(pos + offset); + pos++; + geometry.insert(item); + } + m_analysisdata.insert(name, geometry.serialise()); + } + else { + // Add data with another name + int i = 1; + QString newname = name + " " + QString::number(i); + while (m_analysisdata.contains(newname)) { + i++; + newname = name + " " + QString::number(i); + } + m_analysisdata.insert(newname, geometryWithOffset(data, offset)); } - m_analysisdata.insert(newname, data); } - else m_analysisdata.insert(name, data); + else m_analysisdata.insert(name, geometryWithOffset(data, offset)); + } +} + +const QString DocClipBase::geometryWithOffset(QString data, int offset) +{ + if (offset == 0) return data; + Mlt::Profile *profile = m_baseTrackProducers.at(0)->profile(); + Mlt::Geometry geometry(data.toUtf8().data(), m_properties.value("duration").toInt(), profile->width(), profile->height()); + Mlt::Geometry newgeometry("", m_properties.value("duration").toInt(), profile->width(), profile->height()); + Mlt::GeometryItem item; + int pos = 0; + while (!geometry.next_key(&item, pos)) { + pos = item.frame(); + item.frame(pos + offset); + pos++; + newgeometry.insert(item); } + return newgeometry.serialise(); } QMap DocClipBase::analysisData() const diff --git a/src/docclipbase.h b/src/docclipbase.h index e6e722c2..6ac74221 100644 --- a/src/docclipbase.h +++ b/src/docclipbase.h @@ -200,7 +200,7 @@ Q_OBJECT public: void cleanupProducers(); bool isClean() const; bool getAudioThumbs(); - void setAnalysisData(const QString &name, const QString &data); + void setAnalysisData(const QString &name, const QString &data, int offset = 0); QMap analysisData() const; int lastSeekPosition; /** Cache for every audio Frame with 10 Bytes */ @@ -256,6 +256,8 @@ private: // Private attributes void adjustProducerProperties(Mlt::Producer *prod, const QString &id, bool mute, bool blind); /** @brief Create another instance of a producer. */ Mlt::Producer *cloneProducer(Mlt::Producer *source); + /** @brief Offset all keyframes of a geometry. */ + const QString geometryWithOffset(QString data, int offset); public slots: diff --git a/src/effectstack/collapsibleeffect.cpp b/src/effectstack/collapsibleeffect.cpp index 70733f31..8b5ca260 100644 --- a/src/effectstack/collapsibleeffect.cpp +++ b/src/effectstack/collapsibleeffect.cpp @@ -593,4 +593,7 @@ bool CollapsibleEffect::needsMonitorEffectScene() const return m_paramWidget->needsMonitorEffectScene(); } - +void CollapsibleEffect::setRange(int inPoint , int outPoint) +{ + m_paramWidget->setRange(inPoint, outPoint); +} diff --git a/src/effectstack/collapsibleeffect.h b/src/effectstack/collapsibleeffect.h index 0d053546..42d4aab4 100644 --- a/src/effectstack/collapsibleeffect.h +++ b/src/effectstack/collapsibleeffect.h @@ -73,6 +73,8 @@ public: void adjustButtons(int ix, int max); /** @brief Returns true of this effect requires an on monitor adjustable effect scene. */ bool needsMonitorEffectScene() const; + /** @brief Set clip in / out points. */ + void setRange(int inPoint , int outPoint); public slots: void slotSyncEffectsPos(int pos); diff --git a/src/effectstack/effectstackview2.cpp b/src/effectstack/effectstackview2.cpp index 69c28d75..2c9ceb7a 100644 --- a/src/effectstack/effectstackview2.cpp +++ b/src/effectstack/effectstackview2.cpp @@ -93,14 +93,26 @@ void EffectStackView2::slotRenderPos(int pos) m_effects.at(i)->slotSyncEffectsPos(pos); } +void EffectStackView2::slotClipItemUpdate() +{ + int inPoint = m_clipref->cropStart().frames(KdenliveSettings::project_fps()); + int outPoint = m_clipref->cropDuration().frames(KdenliveSettings::project_fps()) - inPoint; + CollapsibleEffect *effectToMove = NULL; + for (int i = 0; i < m_effects.count(); i++) { + m_effects.at(i)->setRange(inPoint, outPoint); + } +} + void EffectStackView2::slotClipItemSelected(ClipItem* c) { if (c && !c->isEnabled()) return; if (c && c == m_clipref) { } else { + if (m_clipref) disconnect(m_clipref, SIGNAL(updateRange()), this, SLOT(slotClipItemUpdate())); m_clipref = c; if (c) { + connect(m_clipref, SIGNAL(updateRange()), this, SLOT(slotClipItemUpdate())); QString cname = m_clipref->clipName(); if (cname.length() > 30) { m_ui.checkAll->setToolTip(i18n("Effects for %1", cname)); diff --git a/src/effectstack/effectstackview2.h b/src/effectstack/effectstackview2.h index dd34fe09..90b4e9cc 100644 --- a/src/effectstack/effectstackview2.h +++ b/src/effectstack/effectstackview2.h @@ -128,6 +128,10 @@ public slots: * @param c Clip whose effect list should be managed */ void slotClipItemSelected(ClipItem* c); + /** @brief Update the clip range (in-out points) + * @param c Clip whose effect list should be managed */ + void slotClipItemUpdate(); + void slotTrackItemSelected(int ix, const TrackInfo info); /** @brief Check if the mouse wheel events should be used for scrolling the widget view. */ diff --git a/src/effectstack/parametercontainer.cpp b/src/effectstack/parametercontainer.cpp index 89256436..97b2fcf7 100644 --- a/src/effectstack/parametercontainer.cpp +++ b/src/effectstack/parametercontainer.cpp @@ -220,8 +220,10 @@ ParameterContainer::ParameterContainer(QDomElement effect, ItemInfo info, Effect m_geometryWidget = new GeometryWidget(m_metaInfo->monitor, m_metaInfo->timecode, 0, true, effect.hasAttribute("showrotation"), parent); m_geometryWidget->setFrameSize(m_metaInfo->frameSize); connect(m_geometryWidget, SIGNAL(parameterChanged()), this, SLOT(slotCollectAllParameters())); - if (minFrame == maxFrame) + if (minFrame == maxFrame) { m_geometryWidget->setupParam(pa, m_in, m_out); + connect(this, SIGNAL(updateRange(int,int)), m_geometryWidget, SLOT(slotUpdateRange(int,int))); + } else m_geometryWidget->setupParam(pa, minFrame, maxFrame); m_vbox->addWidget(m_geometryWidget); @@ -231,8 +233,10 @@ ParameterContainer::ParameterContainer(QDomElement effect, ItemInfo info, Effect connect(this, SIGNAL(syncEffectsPos(int)), m_geometryWidget, SLOT(slotSyncPosition(int))); } else { Geometryval *geo = new Geometryval(m_metaInfo->profile, m_metaInfo->timecode, m_metaInfo->frameSize, 0); - if (minFrame == maxFrame) + if (minFrame == maxFrame) { geo->setupParam(pa, m_in, m_out); + connect(this, SIGNAL(updateRange(int,int)), geo, SLOT(slotUpdateRange(int,int))); + } else geo->setupParam(pa, minFrame, maxFrame); m_vbox->addWidget(geo); @@ -251,11 +255,13 @@ ParameterContainer::ParameterContainer(QDomElement effect, ItemInfo info, Effect if (pa.attribute("widget") == "corners") { // we want a corners-keyframe-widget CornersWidget *corners = new CornersWidget(m_metaInfo->monitor, pa, m_in, m_out, m_metaInfo->timecode, e.attribute("active_keyframe", "-1").toInt(), parent); + connect(this, SIGNAL(updateRange(int,int)), corners, SLOT(slotUpdateRange(int,int))); m_needsMonitorEffectScene = true; connect(this, SIGNAL(syncEffectsPos(int)), corners, SLOT(slotSyncPosition(int))); geo = static_cast(corners); } else { geo = new KeyframeEdit(pa, m_in, m_out, m_metaInfo->timecode, e.attribute("active_keyframe", "-1").toInt()); + connect(this, SIGNAL(updateRange(int,int)), geo, SLOT(slotUpdateRange(int,int))); } m_vbox->addWidget(geo); m_valueItems[paramName+"keyframe"] = geo; @@ -286,6 +292,7 @@ ParameterContainer::ParameterContainer(QDomElement effect, ItemInfo info, Effect pos = m_out - pos; } PositionEdit *posedit = new PositionEdit(paramName, pos, 0, m_out - m_in, m_metaInfo->timecode); + connect(this, SIGNAL(updateRange(int,int)), posedit, SLOT(setRange(int,int))); m_vbox->addWidget(posedit); m_valueItems[paramName+"position"] = posedit; connect(posedit, SIGNAL(parameterChanged()), this, SLOT(slotCollectAllParameters())); @@ -809,7 +816,11 @@ void ParameterContainer::slotStartFilterJobAction() QDomElement pa = namenode.item(i).toElement(); QString type = pa.attribute("type"); if (type == "filterjob") { + kDebug()<<"// FILTER POSE: "<currentPosition(); QString filterparams = pa.attribute("filterparams"); + if (filterparams.contains("%position")) { + if (m_geometryWidget) filterparams.replace("%position", QString::number(m_geometryWidget->currentPosition())); + } if (filterparams.contains("%params")) { // Replace with current geometry EffectsParameterList parameters; @@ -826,6 +837,8 @@ void ParameterContainer::slotStartFilterJobAction() QDomElement e = jobparams.item(j).toElement(); extraParams.insert(e.attribute("name"), e.text().toUtf8()); } + kDebug()<<"+++++++++++++++++ CLIP IN: "<extra); /** @brief Request import of keyframes from clip data. */ void importClipKeyframes(); + /** @brief Master clip was resized, update effect. */ + void updateRange(int inPoint, int outPoint); }; #endif diff --git a/src/geometryval.cpp b/src/geometryval.cpp index 9dfe5f3e..f28cb1b5 100644 --- a/src/geometryval.cpp +++ b/src/geometryval.cpp @@ -578,4 +578,9 @@ bool Geometryval::keyframeSelected() } - +void Geometryval::slotUpdateRange(int inPoint, int outPoint) +{ + m_helper->setKeyGeometry(m_geom, outPoint - inPoint - 1); + m_helper->update(); + m_timePos.setRange(0, outPoint - inPoint - 1); +} diff --git a/src/geometryval.h b/src/geometryval.h index bccad661..a337d594 100644 --- a/src/geometryval.h +++ b/src/geometryval.h @@ -48,6 +48,7 @@ public: void setFrameSize(QPoint p); /** @brief Updates the timecode display according to settings (frame number or hh:mm:ss:ff) */ void updateTimecodeFormat(); + void slotUpdateRange(int inPoint, int outPoint); private: MltVideoProfile m_profile; diff --git a/src/geometrywidget.cpp b/src/geometrywidget.cpp index 304a1094..7067b94c 100644 --- a/src/geometrywidget.cpp +++ b/src/geometrywidget.cpp @@ -326,8 +326,8 @@ void GeometryWidget::setupParam(const QDomElement elem, int minframe, int maxfra } else { m_ui.widgetTimeWrapper->setHidden(false); m_timeline->setKeyGeometry(m_geometry, m_outPoint - m_inPoint); - m_timePos->setRange(0, m_outPoint - m_inPoint); } + m_timePos->setRange(0, m_outPoint - m_inPoint); // no opacity if (elem.attribute("opacity") == "false") { @@ -379,6 +379,11 @@ void GeometryWidget::slotSyncPosition(int relTimelinePos) } } +int GeometryWidget::currentPosition() const +{ + return m_inPoint + m_timePos->getValue(); +} + void GeometryWidget::slotRequestSeek(int pos) { if (KdenliveSettings::transitionfollowcursor()) @@ -878,5 +883,12 @@ void GeometryWidget::importKeyframes(const QString &data, int maximum) emit parameterChanged(); } +void GeometryWidget::slotUpdateRange(int inPoint, int outPoint) +{ + m_inPoint = inPoint; + m_outPoint = outPoint; + m_timeline->setKeyGeometry(m_geometry, m_outPoint - m_inPoint); + m_timePos->setRange(0, m_outPoint - m_inPoint); +} #include "geometrywidget.moc" diff --git a/src/geometrywidget.h b/src/geometrywidget.h index cdd01cd6..d8e4b9e1 100644 --- a/src/geometrywidget.h +++ b/src/geometrywidget.h @@ -59,6 +59,7 @@ public: void setFrameSize(QPoint size); void addParameter(const QDomElement elem); void importKeyframes(const QString &data, int maximum); + int currentPosition() const; public slots: /** @brief Sets up the rect and the geometry object. @@ -69,6 +70,7 @@ public slots: /** @brief Updates position of the local timeline to @param relTimelinePos. */ void slotSyncPosition(int relTimelinePos); void slotResetKeyframes(); + void slotUpdateRange(int inPoint, int outPoint); private: Ui::GeometryWidget_UI m_ui; diff --git a/src/keyframeedit.cpp b/src/keyframeedit.cpp index e6769721..0d4bc1d3 100644 --- a/src/keyframeedit.cpp +++ b/src/keyframeedit.cpp @@ -471,4 +471,10 @@ void KeyframeEdit::checkVisibleParam() slotUpdateVisibleParameter(0); } +void KeyframeEdit::slotUpdateRange(int inPoint, int outPoint) +{ + m_min = inPoint; + m_max = outPoint; +} + #include "keyframeedit.moc" diff --git a/src/keyframeedit.h b/src/keyframeedit.h index 210192e4..165ccc17 100644 --- a/src/keyframeedit.h +++ b/src/keyframeedit.h @@ -94,6 +94,10 @@ public: /** @brief Makes the first parameter visible in timeline if no parameter is selected. */ void checkVisibleParam(); +public slots: + + void slotUpdateRange(int inPoint, int outPoint); + protected: /** @brief Gets the position of a keyframe from the table. * @param row Row of the keyframe in the table */ diff --git a/src/positionedit.h b/src/positionedit.h index 70dff2ff..dda7b8ee 100644 --- a/src/positionedit.h +++ b/src/positionedit.h @@ -35,8 +35,10 @@ public: int getPosition() const; void setPosition(int pos); void updateTimecodeFormat(); - void setRange(int min, int max); +public slots: + void setRange(int min, int max); + private: TimecodeDisplay *m_display; QSlider *m_slider; diff --git a/src/projectlist.cpp b/src/projectlist.cpp index 5f532320..231e6e4f 100644 --- a/src/projectlist.cpp +++ b/src/projectlist.cpp @@ -3695,7 +3695,7 @@ void ProjectList::slotGotFilterJobResults(QString id, int , int , stringMap resu } if (!dataProcessed || filterInfo.contains("storedata")) { // Store returned data as clip extra data - clip->referencedClip()->setAnalysisData(filterInfo.contains("displaydataname") ? filterInfo.value("displaydataname") : key, results.value(key)); + clip->referencedClip()->setAnalysisData(filterInfo.contains("displaydataname") ? filterInfo.value("displaydataname") : key, results.value(key), filterInfo.value("offset").toInt()); emit updateAnalysisData(clip->referencedClip()); } } -- 2.39.5