Commit 28a919ac authored by Eric Jiang's avatar Eric Jiang Committed by Jean-Baptiste Mardelle
Browse files

Fix Insert Zone to Bin out point off by 1

If the user sets in=100, out=101 and select Insert Zone in Project Bin,
the clip is created 1 frame longer than it should be. This is especially
noticeable when creating a subclip when the out point is the last frame
in the clip, resulting in a broken subclip that cannot be added to the

BUG: 455883
parent 93b68446
......@@ -3730,7 +3730,9 @@ void MainWindow::slotInsertZoneToTree()
QPoint info = m_clipMonitor->getZoneInfo();
QString id;
pCore->projectItemModel()->requestAddBinSubClip(id, info.x(), info.y(), {}, m_clipMonitor->activeClipId());
// clip monitor counts the frame after the out point as the zone out, so we
// need to subtract 1 to get the actual last frame
pCore->projectItemModel()->requestAddBinSubClip(id, info.x(), info.y()-1, {}, m_clipMonitor->activeClipId());
void MainWindow::slotMonitorRequestRenderFrame(bool request)
......@@ -82,6 +82,10 @@ public:
QString getMarkerThumb(GenTime pos);
int getZoneStart();
int getZoneEnd();
/** @brief Get the in and out points selected in the clip monitor.
* @return a QPoint where x() is the in point, and y() is the out point + 1.
* E.g. if the user sets in=100, out=101, then this returns <100, 102>.
QPoint getZoneInfo() const;
void setUpEffectGeometry(const QRect &r, const QVariantList &list = QVariantList(), const QVariantList &types = QVariantList());
/** @brief Set a property on the effect scene */
......@@ -1638,7 +1638,7 @@ bool TimelineModel::requestClipCreation(const QString &binClipId, int &id, Playl
initLength -= in;
res = requestItemResize(clipId, initLength, false, true, local_undo, local_redo);
int updatedDuration = out - in + 1;
int updatedDuration = out - in + 1; // +1: e.g. in=100, out=101 is 2 frames long
res = res && requestItemResize(clipId, updatedDuration, true, true, local_undo, local_redo);
if (!res) {
bool undone = local_undo();
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment