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

Fix composition keyframe view broken

parent 4e6799e0
...@@ -344,8 +344,10 @@ void KeyframeView::mousePressEvent(QMouseEvent *event) ...@@ -344,8 +344,10 @@ void KeyframeView::mousePressEvent(QMouseEvent *event)
return; return;
} }
} }
emit seekToPos(pos + m_inPoint); if (pos != m_position) {
update(); emit seekToPos(pos + m_inPoint);
update();
}
} }
void KeyframeView::mouseMoveEvent(QMouseEvent *event) void KeyframeView::mouseMoveEvent(QMouseEvent *event)
...@@ -449,7 +451,9 @@ void KeyframeView::mouseMoveEvent(QMouseEvent *event) ...@@ -449,7 +451,9 @@ void KeyframeView::mouseMoveEvent(QMouseEvent *event)
} }
if (!m_moveKeyframeMode || KdenliveSettings::keyframeseek()) { if (!m_moveKeyframeMode || KdenliveSettings::keyframeseek()) {
emit seekToPos(pos + m_inPoint); if (pos != m_position) {
emit seekToPos(pos + m_inPoint);
}
} }
return; return;
} }
......
...@@ -211,7 +211,20 @@ KeyframeWidget::KeyframeWidget(std::shared_ptr<AssetParameterModel> model, QMode ...@@ -211,7 +211,20 @@ KeyframeWidget::KeyframeWidget(std::shared_ptr<AssetParameterModel> model, QMode
m_lay->addWidget(m_toolbar); m_lay->addWidget(m_toolbar);
connect(m_time, &TimecodeDisplay::timeCodeEditingFinished, this, [&]() { slotSetPosition(-1, true); }); connect(m_time, &TimecodeDisplay::timeCodeEditingFinished, this, [&]() { slotSetPosition(-1, true); });
connect(m_keyframeview, &KeyframeView::seekToPos, this, [&](int p) { slotSetPosition(p, true); }); connect(m_keyframeview, &KeyframeView::seekToPos, this, [&](int pos) {
if (pos < 0) {
m_time->setValue(0);
m_keyframeview->slotSetPosition(0, true);
} else {
int in = m_model->data(m_index, AssetParameterModel::InRole).toInt();
int p = qMax(0, pos - in);
m_time->setValue(p);
m_keyframeview->slotSetPosition(p, true);
}
m_buttonAddDelete->setEnabled(pos > 0);
slotRefreshParams();
emit seekToPos(pos);
});
connect(m_keyframeview, &KeyframeView::atKeyframe, this, &KeyframeWidget::slotAtKeyframe); connect(m_keyframeview, &KeyframeView::atKeyframe, this, &KeyframeWidget::slotAtKeyframe);
connect(m_keyframeview, &KeyframeView::modified, this, &KeyframeWidget::slotRefreshParams); connect(m_keyframeview, &KeyframeView::modified, this, &KeyframeWidget::slotRefreshParams);
connect(m_keyframeview, &KeyframeView::activateEffect, this, &KeyframeWidget::activateEffect); connect(m_keyframeview, &KeyframeView::activateEffect, this, &KeyframeWidget::activateEffect);
...@@ -390,16 +403,16 @@ void KeyframeWidget::slotSetPosition(int pos, bool update) ...@@ -390,16 +403,16 @@ void KeyframeWidget::slotSetPosition(int pos, bool update)
{ {
if (pos < 0) { if (pos < 0) {
pos = m_time->getValue(); pos = m_time->getValue();
m_keyframeview->slotSetPosition(pos, true);
} else { } else {
m_time->setValue(pos); m_time->setValue(pos);
m_keyframeview->slotSetPosition(pos, true);
} }
m_keyframeview->slotSetPosition(pos, true);
m_buttonAddDelete->setEnabled(pos > 0); m_buttonAddDelete->setEnabled(pos > 0);
slotRefreshParams(); slotRefreshParams();
if (update) { if (update) {
emit seekToPos(pos); int in = m_model->data(m_index, AssetParameterModel::InRole).toInt();
emit seekToPos(pos + in);
} }
} }
......
...@@ -79,7 +79,7 @@ void TransitionStackView::setModel(const std::shared_ptr<AssetParameterModel> &m ...@@ -79,7 +79,7 @@ void TransitionStackView::setModel(const std::shared_ptr<AssetParameterModel> &m
connect(m_trackBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTrack(int))); connect(m_trackBox, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTrack(int)));
connect(this, &AssetParameterView::seekToPos, [this](int pos) { connect(this, &AssetParameterView::seekToPos, [this](int pos) {
// at this point, the effects returns a pos relative to the clip. We need to convert it to a global time // at this point, the effects returns a pos relative to the clip. We need to convert it to a global time
int clipIn = pCore->getItemPosition(m_model->getOwnerId()); int clipIn = 0;//pCore->getItemPosition(m_model->getOwnerId());
emit seekToTransPos(pos + clipIn); emit seekToTransPos(pos + clipIn);
}); });
emit initKeyframeView(true); emit initKeyframeView(true);
......
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