QAction *importKeyframes = new QAction(i18n("Import keyframes from clip"), this);
connect(importKeyframes, SIGNAL(triggered()), this, SIGNAL(importClipKeyframes()));
menu->addAction(importKeyframes);
- QAction *resetKeyframes = new QAction(i18n("Reset keyframes"), this);
+ QAction *resetKeyframes = new QAction(i18n("Reset all keyframes"), this);
connect(resetKeyframes, SIGNAL(triggered()), this, SLOT(slotResetKeyframes()));
menu->addAction(resetKeyframes);
+
+ QAction *resetNextKeyframes = new QAction(i18n("Reset keyframes after cursor"), this);
+ connect(resetNextKeyframes, SIGNAL(triggered()), this, SLOT(slotResetNextKeyframes()));
+ menu->addAction(resetNextKeyframes);
+ QAction *resetPreviousKeyframes = new QAction(i18n("Reset keyframes before cursor"), this);
+ connect(resetPreviousKeyframes, SIGNAL(triggered()), this, SLOT(slotResetPreviousKeyframes()));
+ menu->addAction(resetPreviousKeyframes);
menu->addSeparator();
QAction *syncTimeline = new QAction(KIcon("insert-link"), i18n("Synchronize with timeline cursor"), this);
}
slotPositionChanged(-1, false);
emit parameterChanged();
-
+}
+
+void GeometryWidget::slotResetNextKeyframes()
+{
+ // Delete keyframes after cursor pos
+ Mlt::GeometryItem item;
+ int pos = m_timePos->getValue();
+ while (!m_geometry->next_key(&item, pos)) {
+ m_geometry->remove(item.frame());
+ }
+
+ // Make sure we have at least one keyframe
+ if (m_geometry->next_key(&item, 0)) {
+ item.frame(0);
+ item.x(0);
+ item.y(0);
+ item.w(m_monitor->render->frameRenderWidth());
+ item.h(m_monitor->render->renderHeight());
+ item.mix(100);
+ m_geometry->insert(item);
+ }
+ m_timeline->setKeyGeometry(m_geometry, m_outPoint - m_inPoint);
+ if (m_geomPath) {
+ m_scene->removeItem(m_geomPath);
+ m_geomPath->setPoints(m_geometry);
+ m_scene->addItem(m_geomPath);
+ }
+ slotPositionChanged(-1, false);
+ emit parameterChanged();
+}
+
+void GeometryWidget::slotResetPreviousKeyframes()
+{
+ // Delete keyframes before cursor pos
+ Mlt::GeometryItem item;
+ int pos = 0;
+ while (!m_geometry->next_key(&item, pos) && pos < m_timePos->getValue()) {
+ pos = item.frame() + 1;
+ m_geometry->remove(item.frame());
+ }
+
+ // Make sure we have at least one keyframe
+ if (!m_geometry->next_key(&item, 0)) {
+ item.frame(0);
+ /*item.x(0);
+ item.y(0);
+ item.w(m_monitor->render->frameRenderWidth());
+ item.h(m_monitor->render->renderHeight());
+ item.mix(100);*/
+ m_geometry->insert(item);
+ }
+ else {
+ item.frame(0);
+ item.x(0);
+ item.y(0);
+ item.w(m_monitor->render->frameRenderWidth());
+ item.h(m_monitor->render->renderHeight());
+ item.mix(100);
+ m_geometry->insert(item);
+ }
+ m_timeline->setKeyGeometry(m_geometry, m_outPoint - m_inPoint);
+ if (m_geomPath) {
+ m_scene->removeItem(m_geomPath);
+ m_geomPath->setPoints(m_geometry);
+ m_scene->addItem(m_geomPath);
+ }
+ slotPositionChanged(-1, false);
+ emit parameterChanged();
}
void GeometryWidget::importKeyframes(const QString &data, int maximum)