Fix composition view not refreshing on resize (still broken on undo/redo)

parent 83c95232
......@@ -68,6 +68,7 @@ bool CompositionModel::requestResize(int size, bool right, Fun &undo, Fun &redo,
qDebug() << "compo request resize " << size << right << delta;
int in = getIn();
int out = getOut();
int oldDuration = out - in;
int old_in = in, old_out = out;
if (right) {
out -= delta;
......@@ -108,6 +109,18 @@ bool CompositionModel::requestResize(int size, bool right, Fun &undo, Fun &redo,
}
return false;
};
auto kfr = getKeyframeModel();
if (kfr) {
// Adjust keyframe length
kfr->resizeKeyframes(0, oldDuration, 0, out, undo, redo);
Fun refresh = [kfr, this]() {
kfr->modelChanged();
return true;
};
refresh();
UPDATE_UNDO_REDO(refresh, refresh, undo, redo);
}
UPDATE_UNDO_REDO(operation, reverse, undo, redo);
return true;
}
......
......@@ -21,6 +21,7 @@
#include "transitionstackview.hpp"
#include "assets/model/assetparametermodel.hpp"
#include "assets/keyframes/model/keyframemodellist.hpp"
#include "core.h"
#include <QComboBox>
......@@ -57,6 +58,10 @@ void TransitionStackView::setModel(const std::shared_ptr<AssetParameterModel> &m
lay->addWidget(title);
lay->addWidget(m_trackBox);
m_lay->insertLayout(0, lay);
auto kfr = model->getKeyframeModel();
if (kfr) {
connect(kfr.get(), &KeyframeModelList::modelChanged, this, &AssetParameterView::slotRefresh);
}
connect(model.get(), &AssetParameterModel::compositionTrackChanged, this, &TransitionStackView::checkCompoTrack);
connect(m_trackBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTrack(int)));
connect(this, &AssetParameterView::seekToPos, [this](int pos) {
......@@ -64,6 +69,7 @@ void TransitionStackView::setModel(const std::shared_ptr<AssetParameterModel> &m
int clipIn = pCore->getItemPosition(m_model->getOwnerId());
emit seekToTransPos(pos + clipIn);
});
initKeyframeView(true);
}
void TransitionStackView::updateTrack(int newTrack)
......
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