From 105d3d49a2e40b11fe572bb1bad13f06a567acd5 Mon Sep 17 00:00:00 2001 From: Till Theato Date: Tue, 9 Aug 2011 10:51:07 +0000 Subject: [PATCH] rotoscoping: do not allow to add keyframe until initial spline is created. Corruptions might appear otherwise. svn path=/trunk/kdenlive/; revision=5825 --- src/rotoscoping/rotowidget.cpp | 10 +++++++++- src/simplekeyframes/simplekeyframewidget.cpp | 6 +++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/rotoscoping/rotowidget.cpp b/src/rotoscoping/rotowidget.cpp index 415b5e82..fa4304cb 100644 --- a/src/rotoscoping/rotowidget.cpp +++ b/src/rotoscoping/rotowidget.cpp @@ -141,7 +141,12 @@ void RotoWidget::slotUpdateData(int pos, bool editing) map[QString::number((pos < 0 ? m_keyframeWidget->getPosition() : pos) + m_in).rightJustified(log10((double)m_out) + 1, '0')] = QVariant(vlist); m_data = QVariant(map); } else { + // timeline update is only required if the first keyframe did not exist yet + bool update = m_data.isNull(); m_data = QVariant(vlist); + if (update) { + keyframeTimelineFullUpdate(); + } } emit valueChanged(); @@ -329,7 +334,10 @@ void RotoWidget::keyframeTimelineFullUpdate() m_data = QVariant(map);*/ } else { // static (only one keyframe) - m_keyframeWidget->setKeyframes(QList () << 0); + // make sure the first keyframe was already created + if (m_data.isValid()) { + m_keyframeWidget->setKeyframes(QList () << 0); + } } } diff --git a/src/simplekeyframes/simplekeyframewidget.cpp b/src/simplekeyframes/simplekeyframewidget.cpp index 1ae3bdf6..d7774193 100644 --- a/src/simplekeyframes/simplekeyframewidget.cpp +++ b/src/simplekeyframes/simplekeyframewidget.cpp @@ -70,6 +70,9 @@ SimpleKeyframeWidget::SimpleKeyframeWidget(Timecode t, int duration, QWidget *pa connect(m_buttonAddDelete, SIGNAL(pressed()), m_timeline, SLOT(slotAddRemove())); connect(m_buttonPrevious, SIGNAL(pressed()), m_timeline, SLOT(slotGoToPrev())); connect(m_buttonNext, SIGNAL(pressed()), m_timeline, SLOT(slotGoToNext())); + + // no keyframes yet + setEnabled(false); } SimpleKeyframeWidget::~SimpleKeyframeWidget() @@ -78,7 +81,6 @@ SimpleKeyframeWidget::~SimpleKeyframeWidget() delete m_buttonAddDelete; delete m_buttonPrevious; delete m_buttonNext; - //delete m_buttonSync; delete m_time; } @@ -104,6 +106,7 @@ int SimpleKeyframeWidget::getPosition() void SimpleKeyframeWidget::setKeyframes(const QList< int >& keyframes) { m_timeline->setKeyframes(keyframes); + setEnabled(true); } void SimpleKeyframeWidget::addKeyframe(int pos) @@ -111,6 +114,7 @@ void SimpleKeyframeWidget::addKeyframe(int pos) blockSignals(true); m_timeline->slotAddKeyframe(pos); blockSignals(false); + setEnabled(true); } void SimpleKeyframeWidget::updateTimecodeFormat() -- 2.39.2