Fix crash and keyframe corruption on cli pwith multiple keyframable params

parent f7a96a96
...@@ -99,7 +99,6 @@ KeyframeWidget::KeyframeWidget(std::shared_ptr<AssetParameterModel> model, QMode ...@@ -99,7 +99,6 @@ KeyframeWidget::KeyframeWidget(std::shared_ptr<AssetParameterModel> model, QMode
Monitor *monitor = pCore->getMonitor(m_model->monitorId); Monitor *monitor = pCore->getMonitor(m_model->monitorId);
connect(monitor, &Monitor::seekPosition, this, &KeyframeWidget::monitorSeek, Qt::UniqueConnection); connect(monitor, &Monitor::seekPosition, this, &KeyframeWidget::monitorSeek, Qt::UniqueConnection);
connect(monitor, &Monitor::seekToKeyframe, this, &KeyframeWidget::slotSeekToKeyframe, Qt::UniqueConnection);
m_time = new TimecodeDisplay(pCore->timecode(), this); m_time = new TimecodeDisplay(pCore->timecode(), this);
m_time->setRange(0, duration - 1); m_time->setRange(0, duration - 1);
...@@ -287,7 +286,7 @@ void KeyframeWidget::slotAtKeyframe(bool atKeyframe, bool singleKeyframe) ...@@ -287,7 +286,7 @@ void KeyframeWidget::slotAtKeyframe(bool atKeyframe, bool singleKeyframe)
m_buttonAddDelete->setIcon(QIcon::fromTheme(QStringLiteral("list-add"))); m_buttonAddDelete->setIcon(QIcon::fromTheme(QStringLiteral("list-add")));
m_buttonAddDelete->setToolTip(i18n("Add keyframe")); m_buttonAddDelete->setToolTip(i18n("Add keyframe"));
} }
pCore->getMonitor(m_model->monitorId)->setEffectKeyframe(atKeyframe || singleKeyframe); emit updateEffectKeyframe(atKeyframe || singleKeyframe);
m_selectType->setEnabled(atKeyframe || singleKeyframe); m_selectType->setEnabled(atKeyframe || singleKeyframe);
for (const auto &w : m_parameters) { for (const auto &w : m_parameters) {
w.second->setEnabled(atKeyframe || singleKeyframe); w.second->setEnabled(atKeyframe || singleKeyframe);
...@@ -406,12 +405,12 @@ void KeyframeWidget::addParameter(const QPersistentModelIndex &index) ...@@ -406,12 +405,12 @@ void KeyframeWidget::addParameter(const QPersistentModelIndex &index)
void KeyframeWidget::slotInitMonitor(bool active) void KeyframeWidget::slotInitMonitor(bool active)
{ {
connectMonitor(active);
Monitor *monitor = pCore->getMonitor(m_model->monitorId); Monitor *monitor = pCore->getMonitor(m_model->monitorId);
if (m_keyframeview) { if (m_keyframeview) {
m_keyframeview->initKeyframePos(); m_keyframeview->initKeyframePos();
connect(monitor, &Monitor::updateScene, m_keyframeview, &KeyframeView::slotModelChanged, Qt::UniqueConnection); connect(monitor, &Monitor::updateScene, m_keyframeview, &KeyframeView::slotModelChanged, Qt::UniqueConnection);
} }
connectMonitor(active);
} }
void KeyframeWidget::connectMonitor(bool active) void KeyframeWidget::connectMonitor(bool active)
...@@ -426,10 +425,14 @@ void KeyframeWidget::connectMonitor(bool active) ...@@ -426,10 +425,14 @@ void KeyframeWidget::connectMonitor(bool active)
connect(monitor, &Monitor::seekToNextKeyframe, m_keyframeview, &KeyframeView::slotGoToNext, Qt::UniqueConnection); connect(monitor, &Monitor::seekToNextKeyframe, m_keyframeview, &KeyframeView::slotGoToNext, Qt::UniqueConnection);
connect(monitor, &Monitor::seekToPreviousKeyframe, m_keyframeview, &KeyframeView::slotGoToPrev, Qt::UniqueConnection); connect(monitor, &Monitor::seekToPreviousKeyframe, m_keyframeview, &KeyframeView::slotGoToPrev, Qt::UniqueConnection);
connect(monitor, &Monitor::addRemoveKeyframe, m_keyframeview, &KeyframeView::slotAddRemove, Qt::UniqueConnection); connect(monitor, &Monitor::addRemoveKeyframe, m_keyframeview, &KeyframeView::slotAddRemove, Qt::UniqueConnection);
connect(this, &KeyframeWidget::updateEffectKeyframe, monitor, &Monitor::setEffectKeyframe, Qt::DirectConnection);
connect(monitor, &Monitor::seekToKeyframe, this, &KeyframeWidget::slotSeekToKeyframe, Qt::UniqueConnection);
} else { } else {
disconnect(monitor, &Monitor::seekToNextKeyframe, m_keyframeview, &KeyframeView::slotGoToNext); disconnect(monitor, &Monitor::seekToNextKeyframe, m_keyframeview, &KeyframeView::slotGoToNext);
disconnect(monitor, &Monitor::seekToPreviousKeyframe, m_keyframeview, &KeyframeView::slotGoToPrev); disconnect(monitor, &Monitor::seekToPreviousKeyframe, m_keyframeview, &KeyframeView::slotGoToPrev);
disconnect(monitor, &Monitor::addRemoveKeyframe, m_keyframeview, &KeyframeView::slotAddRemove); disconnect(monitor, &Monitor::addRemoveKeyframe, m_keyframeview, &KeyframeView::slotAddRemove);
disconnect(this, &KeyframeWidget::updateEffectKeyframe, monitor, &Monitor::setEffectKeyframe);
disconnect(monitor, &Monitor::seekToKeyframe, this, &KeyframeWidget::slotSeekToKeyframe);
} }
for (const auto &w : m_parameters) { for (const auto &w : m_parameters) {
auto type = m_model->data(w.first, AssetParameterModel::TypeRole).value<ParamType>(); auto type = m_model->data(w.first, AssetParameterModel::TypeRole).value<ParamType>();
......
...@@ -104,6 +104,7 @@ private: ...@@ -104,6 +104,7 @@ private:
signals: signals:
void addIndex(QPersistentModelIndex ix); void addIndex(QPersistentModelIndex ix);
void setKeyframes(const QString &); void setKeyframes(const QString &);
void updateEffectKeyframe(bool);
}; };
#endif #endif
...@@ -48,6 +48,9 @@ Item { ...@@ -48,6 +48,9 @@ Item {
onWidthChanged: { onWidthChanged: {
clipMonitorRuler.updateRuler() clipMonitorRuler.updateRuler()
} }
onIskeyframeChanged: {
console.log('KEYFRAME CHANGED: ', iskeyframe,'\n\n.............................')
}
FontMetrics { FontMetrics {
id: fontMetrics id: fontMetrics
...@@ -233,6 +236,7 @@ Item { ...@@ -233,6 +236,7 @@ Item {
} }
onDoubleClicked: { onDoubleClicked: {
console.log('ADDREMOVE ON DBL')
controller.addRemoveKeyframe() controller.addRemoveKeyframe()
} }
onReleased: { onReleased: {
...@@ -281,6 +285,7 @@ Item { ...@@ -281,6 +285,7 @@ Item {
} }
onPressed: { onPressed: {
if (root.iskeyframe == false && controller.autoKeyframe) { if (root.iskeyframe == false && controller.autoKeyframe) {
console.log('ADDREMOVE THAND PRESSED')
controller.addRemoveKeyframe(); controller.addRemoveKeyframe();
} }
oldMouseX = mouseX oldMouseX = mouseX
...@@ -362,6 +367,7 @@ Item { ...@@ -362,6 +367,7 @@ Item {
} }
onPressed: { onPressed: {
if (root.iskeyframe == false && controller.autoKeyframe) { if (root.iskeyframe == false && controller.autoKeyframe) {
console.log('ADDREMOVE TRAND PRESSED')
controller.addRemoveKeyframe(); controller.addRemoveKeyframe();
} }
oldMouseX = mouseX oldMouseX = mouseX
...@@ -432,6 +438,7 @@ Item { ...@@ -432,6 +438,7 @@ Item {
} }
onPressed: { onPressed: {
if (root.iskeyframe == false && controller.autoKeyframe) { if (root.iskeyframe == false && controller.autoKeyframe) {
console.log('ADDREMOVE BLAND PRESSED')
controller.addRemoveKeyframe(); controller.addRemoveKeyframe();
} }
oldMouseX = mouseX oldMouseX = mouseX
...@@ -502,6 +509,7 @@ Item { ...@@ -502,6 +509,7 @@ Item {
} }
onPressed: { onPressed: {
if (root.iskeyframe == false && controller.autoKeyframe) { if (root.iskeyframe == false && controller.autoKeyframe) {
console.log('ADDREMOVE BRHAND PRESSED')
controller.addRemoveKeyframe(); controller.addRemoveKeyframe();
} }
oldMouseX = mouseX oldMouseX = mouseX
...@@ -569,6 +577,7 @@ Item { ...@@ -569,6 +577,7 @@ Item {
onExited: { framerect.hoverColor = '#ffffff'} onExited: { framerect.hoverColor = '#ffffff'}
onPressed: { onPressed: {
if (root.iskeyframe == false && controller.autoKeyframe) { if (root.iskeyframe == false && controller.autoKeyframe) {
console.log('ADDREMOVE CENTER PRESSED')
controller.addRemoveKeyframe(); controller.addRemoveKeyframe();
} }
oldMouseX = mouseX oldMouseX = mouseX
......
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