From: Ed Rogalsky Date: Tue, 6 Nov 2012 16:20:28 +0000 (+0100) Subject: Merge branch 'master' into feature/pkey X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=6c819d9cd57a199efc99ec3f6a4a54eae9a232c0;hp=563a57ad4786d528755a99973cf3bffbdce96bcf;p=kdenlive Merge branch 'master' into feature/pkey --- diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp index 6e9706fe..9a53b995 100644 --- a/src/customtrackview.cpp +++ b/src/customtrackview.cpp @@ -7641,7 +7641,23 @@ void CustomTrackView::slotImportClipKeyframes(GRAPHICSRECTITEM type) return; } QString keyframeData = ui.data_list->itemData(ui.data_list->currentIndex()).toString(); - QStringList keyframeList = keyframeData.split(';', QString::SkipEmptyParts); + + int offset = item->cropStart().frames(m_document->fps()); + Mlt::Geometry geometry(keyframeData.toUtf8().data(), item->baseClip()->maxDuration().frames(m_document->fps()), m_document->mltProfile().width, m_document->mltProfile().height); + Mlt::Geometry newGeometry(QString().toUtf8().data(), item->baseClip()->maxDuration().frames(m_document->fps()), m_document->mltProfile().width, m_document->mltProfile().height); + Mlt::GeometryItem gitem; + geometry.fetch(&gitem, offset); + gitem.frame(0); + newGeometry.insert(gitem); + int pos = offset + 1; + while (!geometry.next_key(&gitem, pos)) { + pos = gitem.frame(); + gitem.frame(pos - offset); + pos++; + newGeometry.insert(gitem); + } + QStringList keyframeList = QString(newGeometry.serialise()).split(';', QString::SkipEmptyParts); + QString result; if (ui.import_position->isChecked()) { if (ui.import_size->isChecked()) { diff --git a/src/geometrywidget.cpp b/src/geometrywidget.cpp index 7067b94c..e92f029c 100644 --- a/src/geometrywidget.cpp +++ b/src/geometrywidget.cpp @@ -57,6 +57,7 @@ GeometryWidget::GeometryWidget(Monitor* monitor, Timecode timecode, int clipPos, setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum); MonitorEditWidget *edit = monitor->getEffectEdit(); edit->removeCustomControls(); + edit->addCustomButton(KIcon("draw-path"), i18n("Show path"), this, SLOT(slotShowPath(bool)), true, KdenliveSettings::onmonitoreffects_geometryshowpath()); edit->addCustomButton(KIcon("transform-crop"), i18n("Show previous keyframe"), this, SLOT(slotShowPreviousKeyFrame(bool)), true, KdenliveSettings::onmonitoreffects_geometryshowprevious()); m_scene = edit->getScene(); m_scene->cleanup(); @@ -119,9 +120,16 @@ GeometryWidget::GeometryWidget(Monitor* monitor, Timecode timecode, int clipPos, 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); @@ -284,6 +292,16 @@ void GeometryWidget::slotShowPreviousKeyFrame(bool show) slotPositionChanged(-1, false); } +void GeometryWidget::slotShowPath(bool show) +{ + KdenliveSettings::setOnmonitoreffects_geometryshowpath(show); + if (m_geomPath) { + if (show) m_scene->addItem(m_geomPath); + else m_scene->removeItem(m_geomPath); + } + slotPositionChanged(-1, false); +} + void GeometryWidget::updateTimecodeFormat() { m_timePos->slotUpdateTimeCodeFormat(); @@ -354,7 +372,8 @@ void GeometryWidget::setupParam(const QDomElement elem, int minframe, int maxfra connect(m_geomPath, SIGNAL(changed()), this, SLOT(slotUpdatePath())); m_geomPath->setPen(QPen(Qt::red)); m_geomPath->setPoints(m_geometry); - m_scene->addItem(m_geomPath); + if (KdenliveSettings::onmonitoreffects_geometryshowpath()) + m_scene->addItem(m_geomPath); m_scene->centerView(); slotPositionChanged(0, false); } @@ -528,7 +547,7 @@ void GeometryWidget::slotDeleteKeyframe(int pos) } m_timeline->update(); - if (m_geomPath) { + if (m_geomPath && KdenliveSettings::onmonitoreffects_geometryshowpath()) { m_scene->removeItem(m_geomPath); m_geomPath->setPoints(m_geometry); m_scene->addItem(m_geomPath); @@ -617,7 +636,7 @@ void GeometryWidget::slotUpdateGeometry() geom->insert(item2); } } - if (m_geomPath) { + if (m_geomPath && KdenliveSettings::onmonitoreffects_geometryshowpath()) { m_scene->removeItem(m_geomPath); m_geomPath->setPoints(m_geometry); m_scene->addItem(m_geomPath); @@ -817,14 +836,81 @@ void GeometryWidget::slotResetKeyframes() item.mix(100); m_geometry->insert(item); m_timeline->setKeyGeometry(m_geometry, m_outPoint - m_inPoint); - if (m_geomPath) { + if (m_geomPath && KdenliveSettings::onmonitoreffects_geometryshowpath()) { + m_scene->removeItem(m_geomPath); + m_geomPath->setPoints(m_geometry); + m_scene->addItem(m_geomPath); + } + 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 && KdenliveSettings::onmonitoreffects_geometryshowpath()) { + 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 && KdenliveSettings::onmonitoreffects_geometryshowpath()) { 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) @@ -874,7 +960,7 @@ void GeometryWidget::importKeyframes(const QString &data, int maximum) m_geometry->insert(item); } m_timeline->setKeyGeometry(m_geometry, m_outPoint - m_inPoint); - if (m_geomPath) { + if (m_geomPath && KdenliveSettings::onmonitoreffects_geometryshowpath()) { m_scene->removeItem(m_geomPath); m_geomPath->setPoints(m_geometry); m_scene->addItem(m_geomPath); diff --git a/src/geometrywidget.h b/src/geometrywidget.h index d8e4b9e1..aaa82b97 100644 --- a/src/geometrywidget.h +++ b/src/geometrywidget.h @@ -70,6 +70,8 @@ public slots: /** @brief Updates position of the local timeline to @param relTimelinePos. */ void slotSyncPosition(int relTimelinePos); void slotResetKeyframes(); + void slotResetNextKeyframes(); + void slotResetPreviousKeyframes(); void slotUpdateRange(int inPoint, int outPoint); private: @@ -175,6 +177,8 @@ private slots: void slotFitToHeight(); /** @brief Show / hide previous keyframe in monitor scene. */ void slotShowPreviousKeyFrame(bool show); + /** @brief Show / hide keyframe path in monitor scene. */ + void slotShowPath(bool show); signals: void parameterChanged(); diff --git a/src/kdenlivesettings.kcfg b/src/kdenlivesettings.kcfg index ca309317..b6044801 100644 --- a/src/kdenlivesettings.kcfg +++ b/src/kdenlivesettings.kcfg @@ -796,6 +796,11 @@ false + + + true + + false diff --git a/src/projectlist.cpp b/src/projectlist.cpp index 231e6e4f..a00d6f40 100644 --- a/src/projectlist.cpp +++ b/src/projectlist.cpp @@ -3516,6 +3516,14 @@ void ProjectList::startClipFilterJob(const QString &filterName, const QString &c extraParams.insert("projecttreefilter", "1"); QString keyword("%count"); extraParams.insert("resultmessage", i18n("Found %1 scenes.", keyword)); + if (ui.store_data->isChecked()) { + // We want to save result as clip metadata + extraParams.insert("storedata", "1"); + } + if (ui.zone_only->isChecked()) { + // We want to analyze only clip zone + extraParams.insert("zoneonly", "1"); + } if (ui.add_markers->isChecked()) { // We want to create markers extraParams.insert("addmarkers", QString::number(ui.marker_type->currentIndex())); @@ -3556,6 +3564,13 @@ void ProjectList::processClipJob(QStringList ids, const QString&destination, boo ProjectItem *item = getItemById(id); if (!item) continue; QStringList jobArgs; + if (extraParams.contains("zoneonly")) { + // Analyse clip zone only, remove in / out and replace with zone + preParams.takeFirst(); + preParams.takeFirst(); + QPoint zone = item->referencedClip()->zone(); + jobArgs << QString::number(zone.x()) << QString::number(zone.y()); + } jobArgs << preParams; if (ids.count() == 1) { jobArgs << consumer + ':' + destination; @@ -3647,6 +3662,7 @@ void ProjectList::slotGotFilterJobResults(QString id, int , int , stringMap resu } bool dataProcessed = false; QString key = filterInfo.value("key"); + int offset = filterInfo.value("offset").toInt(); QStringList value = results.value(key).split(';', QString::SkipEmptyParts); kDebug()<<"// RESULT; "<childCount() == 0) @@ -3686,7 +3702,7 @@ void ProjectList::slotGotFilterJobResults(QString id, int , int , stringMap resu int newPos = pos.section("=", 0, 0).toInt(); // Don't use scenes shorter than 1 second if (newPos - cutPos < 24) continue; - CommentedTime m(GenTime(newPos, m_fps), QString::number(index), markersType); + CommentedTime m(GenTime(newPos + offset, m_fps), QString::number(index), markersType); markersList << m; index++; cutPos = newPos; diff --git a/src/projecttree/meltjob.cpp b/src/projecttree/meltjob.cpp index 55926077..1bc16c69 100644 --- a/src/projecttree/meltjob.cpp +++ b/src/projecttree/meltjob.cpp @@ -67,6 +67,7 @@ void MeltJob::startJob() return; } int in = m_params.takeFirst().toInt(); + if (in > 0 && !m_extra.contains("offset")) m_extra.insert("offset", QString::number(in)); int out = m_params.takeFirst().toInt(); QString producerParams =m_params.takeFirst(); QString filter = m_params.takeFirst(); @@ -97,11 +98,13 @@ void MeltJob::startJob() } if (out == -1) { prod = new Mlt::Producer(*m_profile, m_url.toUtf8().constData()); + m_length = prod->get_length(); } else { Mlt::Producer *tmp = new Mlt::Producer(*m_profile, m_url.toUtf8().constData()); prod = tmp->cut(in, out); delete tmp; + m_length = prod->get_playtime(); } if (m_extra.contains("producer_profile")) { m_profile->from_producer(*prod); @@ -150,7 +153,6 @@ void MeltJob::startJob() Mlt::Playlist playlist; playlist.append(*prod); tractor.set_track(playlist, 0); - m_length = prod->get_length(); m_consumer->connect(tractor); prod->set_speed(0); prod->seek(0); diff --git a/src/transitionsettings.cpp b/src/transitionsettings.cpp index 996d8a89..dc8c0f47 100644 --- a/src/transitionsettings.cpp +++ b/src/transitionsettings.cpp @@ -122,9 +122,21 @@ void TransitionSettings::slotTransitionChanged(bool reinit, bool updateCurrent) m_effectEdit->transferParamDesc(e, m_usedTransition->info(), false); } else { // Same transition, we just want to update the parameters value - slotUpdateEffectParams(e, e); - if (m_usedTransition->hasGeometry()) - m_effectEdit->transferParamDesc(m_usedTransition->toXML(), m_usedTransition->info(), false); + int ix = transitionList->findData(m_usedTransition->transitionInfo(), Qt::UserRole, Qt::MatchExactly); + if (ix != transitionList->currentIndex()) { + // Transition type changed, reload params + transitionList->blockSignals(true); + transitionList->setCurrentIndex(ix); + transitionList->blockSignals(false); + m_effectEdit->transferParamDesc(e, m_usedTransition->info(), false); + } + else { + slotUpdateEffectParams(e, e); + if (m_usedTransition->hasGeometry()) + m_effectEdit->transferParamDesc(m_usedTransition->toXML(), m_usedTransition->info(), false); + } + if (m_effectEdit->needsMonitorEffectScene()) + connect(m_effectEdit->monitor(), SIGNAL(renderPosition(int)), this, SLOT(slotRenderPos(int))); } slotCheckMonitorPosition(m_effectEdit->monitor()->render->seekFramePosition()); } @@ -153,7 +165,7 @@ void TransitionSettings::slotTransitionItemSelected(Transition* t, int nextTrack m_effectEdit->setFrameSize(p); m_autoTrackTransition = nextTrack; disconnect(m_effectEdit->monitor(), SIGNAL(renderPosition(int)), this, SLOT(slotRenderPos(int))); - if (t == m_usedTransition) { + if (t == m_usedTransition) { if (t == NULL) return; if (update) { transitionTrack->blockSignals(true); diff --git a/src/widgets/scenecutdialog_ui.ui b/src/widgets/scenecutdialog_ui.ui index 462ff597..17c54a8c 100644 --- a/src/widgets/scenecutdialog_ui.ui +++ b/src/widgets/scenecutdialog_ui.ui @@ -6,50 +6,57 @@ 0 0 - 352 - 90 + 282 + 115 Scene Cut - - - - Qt::Horizontal + + + + + + + Add clip markers - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + true + + + + + + + Analyse only selected zone - + Qt::Vertical - 218 - 2 + 20 + 40 - - - - Add clip markers + + + + Qt::Horizontal - - true + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - @@ -57,6 +64,13 @@ + + + + Save result in clip metadata + + +