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

Correctly update add/remove keyframe button on undo/redo and active keyframe on speed change

parent 6c3ad4bd
......@@ -311,15 +311,20 @@ void RemapView::loadKeyframes(const QString &mapData)
m_duration = qMax(m_duration, pos - m_inFrame);
m_duration = qMax(m_duration, val - m_inFrame);
}
bool isKfr = m_keyframes.contains(m_bottomPosition + m_inFrame);
if (isKfr) {
bool isLast = m_bottomPosition + m_inFrame == m_keyframes.firstKey() || m_bottomPosition + m_inFrame == m_keyframes.lastKey();
emit atKeyframe(isKfr, isLast);
} else {
emit atKeyframe(false, false);
}
if (m_keyframes.contains(m_currentKeyframe.first)) {
bool isLast = m_currentKeyframe.first == m_keyframes.firstKey() || m_currentKeyframe.first == m_keyframes.lastKey();
emit atKeyframe(true, isLast);
//bool isLast = m_currentKeyframe.first == m_keyframes.firstKey() || m_currentKeyframe.first == m_keyframes.lastKey();
//emit atKeyframe(true, isLast);
std::pair<double,double>speeds = getSpeed(m_currentKeyframe);
std::pair<bool,bool> atEnd = {m_currentKeyframe.first == m_inFrame, m_currentKeyframe.first == m_keyframes.lastKey()};
emit selectedKf(m_currentKeyframe, speeds, atEnd);
} else {
emit atKeyframe(false, false);
m_currentKeyframe = {-1,-1};
emit selectedKf(m_currentKeyframe, {-1,-1} );
}
......@@ -1997,6 +2002,7 @@ void TimeRemap::updateKeyframesWithUndo(const QMap<int,int> &updatedKeyframes, c
}
return true;
};
local_redo();
if (durationChanged) {
int length = updatedKeyframes.lastKey() - m_view->m_inFrame + 1;
std::shared_ptr<TimelineItemModel> model = pCore->window()->getCurrentTimeline()->controller()->getModel();
......@@ -2005,7 +2011,6 @@ void TimeRemap::updateKeyframesWithUndo(const QMap<int,int> &updatedKeyframes, c
model->requestItemResize(m_splitId, length, true, true, undo, redo);
}
}
local_redo();
UPDATE_UNDO_REDO_NOLOCK(redo, undo, local_undo, local_redo);
pCore->pushUndo(local_undo, local_redo, i18n("Edit Timeremap keyframes"));
}
......
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