Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Fix resize keyframes when only 2 keyframes at in/out

parent 71823937
Pipeline #9773 passed with stage
in 14 minutes and 15 seconds
......@@ -430,6 +430,21 @@ void KeyframeModelList::resizeKeyframes(int oldIn, int oldOut, int in, int out,
bool ok3;
Keyframe toDel = getNextKeyframe(new_out, &ok3);
if (ok && !ok2) {
// Check if we have only 2 keyframes (in/out), in which case we move the out keyframe to new position
bool ok4;
kf = getPrevKeyframe(old_out, &ok4);
if (ok4) {
GenTime current_in(oldIn, pCore->getCurrentFps());
qDebug()<<" = = = = = = = \n\nGOT 2 KF SITUATION: "<<current_in.frames(25)<<" = "<<kf.first.frames(25);
if (kf.first == current_in) {
// We have a 2 keyframes situation, move last one to new out
for (const auto &param : m_parameters) {
param.second->moveKeyframe(old_out, new_out, QVariant(), undo, redo);
}
return;
}
}
positions << old_out;
}
if (toDel.first == GenTime()) {
......
......@@ -581,7 +581,7 @@ bool EffectStackModel::adjustStackLength(bool adjustFromEnd, int oldIn, int oldD
std::shared_ptr<KeyframeModelList> keyframes = effect->getKeyframeModel();
if (keyframes != nullptr) {
// Effect has keyframes, update these
keyframes->resizeKeyframes(oldIn, oldIn + oldDuration - 1, newIn, out - 1, offset, adjustFromEnd, undo, redo);
keyframes->resizeKeyframes(oldIn, oldIn + oldDuration, newIn, out - 1, offset, adjustFromEnd, undo, redo);
QModelIndex index = getIndexFromItem(effect);
Fun refresh = [effect, index]() {
effect->dataChanged(index, index, QVector<int>());
......
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