]> git.sesse.net Git - kdenlive/commitdiff
rotoscoping: do not allow to add keyframe until initial spline is created.
authorTill Theato <root@ttill.de>
Tue, 9 Aug 2011 10:51:07 +0000 (10:51 +0000)
committerTill Theato <root@ttill.de>
Tue, 9 Aug 2011 10:51:07 +0000 (10:51 +0000)
Corruptions might appear otherwise.

svn path=/trunk/kdenlive/; revision=5825

src/rotoscoping/rotowidget.cpp
src/simplekeyframes/simplekeyframewidget.cpp

index 415b5e82f7043374febcfa5a9e57836cad38db34..fa4304cb4b2d1991f21a3295d3e6d66b8eea6f2e 100644 (file)
@@ -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 <int>() << 0);
+        // make sure the first keyframe was already created
+        if (m_data.isValid()) {
+            m_keyframeWidget->setKeyframes(QList <int>() << 0);
+        }
     }
 }
 
index 1ae3bdf68fe022174a357bdbeb8c02e4073d3377..d7774193a15d1c287f68f399a6340e7a890bbfac 100644 (file)
@@ -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()