Commit c03ccad4 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Speed effect: fix negative speed incorrectly moving in/out and wrong thumbnails

parent e716e00e
Pipeline #7478 passed with stage
in 21 minutes and 55 seconds
......@@ -458,8 +458,8 @@ bool ClipModel::useTimewarpProducer(double speed, bool changeDuration, Fun &undo
int in = getIn();
int out = getOut();
int duration = out - in;
in = qMax(0, (int)(m_producer->get_length() * std::fabs(m_speed) - out - 1));
out = in + duration;
in = qMax(0, (int)((m_producer->get_length() * std::fabs(m_speed/speed)) - 1 - (out * std::fabs(m_speed/speed))));
out = in + newDuration;
operation = [operation, in, out, this]() {
bool res = operation();
if (res) {
......
......@@ -30,6 +30,9 @@ Row {
property int startFrame: clipRoot.inPoint
property int endFrame: clipRoot.outPoint
property real imageWidth: Math.max(thumbRow.thumbWidth, container.width / thumbRepeater.count)
property int thumbStartFrame: (clipRoot.speed >= 0) ? Math.round(clipRoot.inPoint * clipRoot.speed) : Math.round((clipRoot.maxDuration - clipRoot.inPoint) * -clipRoot.speed - 1)
property int thumbEndFrame: (clipRoot.speed >= 0) ? Math.round(clipRoot.outPoint * clipRoot.speed) : Math.round((clipRoot.maxDuration - clipRoot.outPoint) * -clipRoot.speed - 1)
Image {
width: thumbRepeater.imageWidth
height: container.height
......@@ -38,7 +41,7 @@ Row {
cache: enableCache
property int currentFrame: Math.floor(clipRoot.inPoint + Math.round((index) * width / timeline.scaleFactor)* clipRoot.speed)
horizontalAlignment: thumbRepeater.count < 3 ? (index == 0 ? Image.AlignLeft : Image.AlignRight) : Image.AlignLeft
source: thumbRepeater.count < 3 ? (index == 0 ? clipRoot.baseThumbPath + Math.floor(clipRoot.inPoint * clipRoot.speed) : clipRoot.baseThumbPath + Math.floor(clipRoot.outPoint * clipRoot.speed)) : (index * width < thumbRow.scrollStart - width || index * width > thumbRow.scrollEnd) ? '' : clipRoot.baseThumbPath + currentFrame
source: thumbRepeater.count < 3 ? (index == 0 ? clipRoot.baseThumbPath + thumbRepeater.thumbStartFrame : clipRoot.baseThumbPath + thumbRepeater.thumbEndFrame) : (index * width < thumbRow.scrollStart - width || index * width > thumbRow.scrollEnd) ? '' : clipRoot.baseThumbPath + currentFrame
}
}
}
Markdown is supported
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