From 2436bd91119bc5a349237db700643829e7eb21d6 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Mon, 9 Apr 2012 23:56:27 +0200 Subject: [PATCH] First steps for the incredible filter region --- data/blacklisted_effects.txt | 2 +- effects/CMakeLists.txt | 1 + effects/README | 1 + effects/region.xml | 10 ++ src/customtrackview.cpp | 35 +++++-- src/customtrackview.h | 3 + src/effectslist.cpp | 11 +++ src/effectstack/collapsibleeffect.cpp | 42 +++++++- src/effectstack/collapsibleeffect.h | 6 ++ src/effectstack/effectstackview2.cpp | 63 +++++++++++- src/effectstack/effectstackview2.h | 3 + src/trackview.cpp | 132 +++++++++++++++++--------- src/trackview.h | 6 ++ src/widgets/urlval_ui.ui | 12 +-- 14 files changed, 264 insertions(+), 63 deletions(-) create mode 100644 effects/region.xml diff --git a/data/blacklisted_effects.txt b/data/blacklisted_effects.txt index 3b3d11d2..c553ba94 100644 --- a/data/blacklisted_effects.txt +++ b/data/blacklisted_effects.txt @@ -93,7 +93,7 @@ luma data_show gtkrescale watermark -region +#region resize resample mono diff --git a/effects/CMakeLists.txt b/effects/CMakeLists.txt index 8aa6c04d..2fe9e115 100644 --- a/effects/CMakeLists.txt +++ b/effects/CMakeLists.txt @@ -22,6 +22,7 @@ normalise.xml oldfilm.xml pan_zoom.xml obscure.xml +region.xml rotation.xml rotation_keyframable.xml scratchlines.xml diff --git a/effects/README b/effects/README index b19bba35..7cc34eb7 100644 --- a/effects/README +++ b/effects/README @@ -49,6 +49,7 @@ The rest: - tag "name": visible name of the parameter (depending on the GUI this parameter uses) - tag "comment": (optional) description of the parameter (support HTML formatting) (not yet supported by all widgets) - attribute "name": MLT filter parameter name + - attribute "paramprefix": a string to be prepended to the parameter value before passing it to MLT - attribute "default": initial value, format depends on parameter type - attribute "type": widget (GUI) to use - "fixed": diff --git a/effects/region.xml b/effects/region.xml new file mode 100644 index 00000000..9f76c090 --- /dev/null +++ b/effects/region.xml @@ -0,0 +1,10 @@ + + + Regionalize + Apply sub-effects to a region defined by a clip's alpha channel + Charles Yates + + Url + + + diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp index ace533d4..4651997e 100644 --- a/src/customtrackview.cpp +++ b/src/customtrackview.cpp @@ -6691,7 +6691,7 @@ EffectsParameterList CustomTrackView::getEffectArgs(const QDomElement &effect) EffectsParameterList parameters; QLocale locale; parameters.addParam("tag", effect.attribute("tag")); - if (effect.hasAttribute("region")) parameters.addParam("region", effect.attribute("region")); + //if (effect.hasAttribute("region")) parameters.addParam("region", effect.attribute("region")); parameters.addParam("kdenlive_ix", effect.attribute("kdenlive_ix")); parameters.addParam("kdenlive_info", effect.attribute("kdenlive_info")); parameters.addParam("id", effect.attribute("id")); @@ -6699,16 +6699,37 @@ EffectsParameterList CustomTrackView::getEffectArgs(const QDomElement &effect) if (effect.hasAttribute("disable")) parameters.addParam("disable", effect.attribute("disable")); if (effect.hasAttribute("in")) parameters.addParam("in", effect.attribute("in")); if (effect.hasAttribute("out")) parameters.addParam("out", effect.attribute("out")); + if (effect.attribute("id") == "region") { + QDomNodeList subeffects = effect.elementsByTagName("effect"); + for (int i = 0; i < subeffects.count(); i++) { + QDomElement subeffect = subeffects.at(i).toElement(); + int subeffectix = subeffect.attribute("region_ix").toInt(); + parameters.addParam(QString("filter%1").arg(subeffectix), subeffect.attribute("id")); + parameters.addParam(QString("filter%1.tag").arg(subeffectix), subeffect.attribute("tag")); + parameters.addParam(QString("filter%1.kdenlive_info").arg(subeffectix), subeffect.attribute("kdenlive_info")); + QDomNodeList subparams = subeffect.elementsByTagName("parameter"); + adjustEffectParameters(parameters, subparams, QString("filter%1.").arg(subeffectix)); + } + } QDomNodeList params = effect.elementsByTagName("parameter"); - for (int i = 0; i < params.count(); i++) { + adjustEffectParameters(parameters, params); + + return parameters; +} + + +void CustomTrackView::adjustEffectParameters(EffectsParameterList ¶meters, QDomNodeList params, const QString &prefix) +{ + QLocale locale; + for (int i = 0; i < params.count(); i++) { QDomElement e = params.item(i).toElement(); + QString paramname = prefix + e.attribute("name"); if (e.attribute("type") == "geometry" && !e.hasAttribute("fixed")) { // effects with geometry param need in / out synced with the clip, request it... parameters.addParam("_sync_in_out", "1"); } if (e.attribute("type") == "simplekeyframe") { - QStringList values = e.attribute("keyframes").split(";", QString::SkipEmptyParts); double factor = e.attribute("factor", "1").toDouble(); double offset = e.attribute("offset", "0").toDouble(); @@ -6718,7 +6739,7 @@ EffectsParameterList CustomTrackView::getEffectArgs(const QDomElement &effect) values[j] = pos + "=" + locale.toString(val); } // kDebug() << "/ / / /SENDING KEYFR:" << values; - parameters.addParam(e.attribute("name"), values.join(";")); + parameters.addParam(paramname, values.join(";")); /*parameters.addParam(e.attribute("name"), e.attribute("keyframes").replace(":", "=")); parameters.addParam("max", e.attribute("max")); parameters.addParam("min", e.attribute("min")); @@ -6754,15 +6775,15 @@ EffectsParameterList CustomTrackView::getEffectArgs(const QDomElement &effect) fact = e.attribute("factor", "1").toDouble(); } double offset = e.attribute("offset", "0").toDouble(); - parameters.addParam(e.attribute("name"), locale.toString((e.attribute("value").toDouble() - offset) / fact)); + parameters.addParam(paramname, locale.toString((e.attribute("value").toDouble() - offset) / fact)); } else { - parameters.addParam(e.attribute("name"), e.attribute("value")); + parameters.addParam(paramname, e.attribute("value")); } } } - return parameters; } + void CustomTrackView::updateTrackNames(int track, bool added) { QList tracks = m_document->tracksList(); diff --git a/src/customtrackview.h b/src/customtrackview.h index f4175ab3..e419dedf 100644 --- a/src/customtrackview.h +++ b/src/customtrackview.h @@ -445,6 +445,9 @@ private: /** @brief Prepare an add clip command for an effect */ void processEffect(ClipItem *item, QDomElement effect, QUndoCommand *effectCommand); + + /** @brief Get effect parameters ready for MLT*/ + void adjustEffectParameters(EffectsParameterList ¶meters, QDomNodeList params, const QString &prefix = QString()); private slots: void slotRefreshGuides(); diff --git a/src/effectslist.cpp b/src/effectslist.cpp index 407c51b8..af064380 100644 --- a/src/effectslist.cpp +++ b/src/effectslist.cpp @@ -203,13 +203,24 @@ void EffectsList::clearList() void EffectsList::setParameter(QDomElement effect, const QString &name, const QString &value) { QDomNodeList params = effect.elementsByTagName("parameter"); + bool found = false; for (int i = 0; i < params.count(); i++) { QDomElement e = params.item(i).toElement(); if (e.attribute("name") == name) { e.setAttribute("value", value); + found = true; break; } } + if (!found) { + // create property + QDomDocument doc = effect.ownerDocument(); + QDomElement e = doc.createElement("parameter"); + e.setAttribute("name", name); + QDomText val = doc.createTextNode(value); + e.appendChild(val); + effect.appendChild(e); + } } // static diff --git a/src/effectstack/collapsibleeffect.cpp b/src/effectstack/collapsibleeffect.cpp index 9f2af1f5..0bf2bb2e 100644 --- a/src/effectstack/collapsibleeffect.cpp +++ b/src/effectstack/collapsibleeffect.cpp @@ -60,6 +60,7 @@ #include #include #include +#include class Boolval: public QWidget, public Ui::Boolval_UI { @@ -126,9 +127,14 @@ CollapsibleEffect::CollapsibleEffect(QDomElement effect, QDomElement original_ef m_paramWidget(NULL), m_effect(effect), m_original_effect(original_effect), - m_lastEffect(lastEffect) + m_lastEffect(lastEffect), + m_regionEffect(false) { setupUi(this); + if (m_effect.attribute("tag") == "region") { + m_regionEffect = true; + decoframe->setObjectName("decoframegroup"); + } filterWheelEvent = true; m_info.fromString(effect.attribute("kdenlive_info")); setFont(KGlobalSettings::smallestReadableFont()); @@ -151,12 +157,15 @@ CollapsibleEffect::CollapsibleEffect(QDomElement effect, QDomElement original_ef //buttonShowComments->setIcon(KIcon("help-about")); //buttonShowComments->setToolTip(i18n("Show additional information for the parameters")); m_menu = new QMenu; + if (m_regionEffect) m_menu->addAction(KIcon("document-new"), i18n("Change Region"), this, SLOT(slotResetEffect())); m_menu->addAction(KIcon("view-refresh"), i18n("Reset Effect"), this, SLOT(slotResetEffect())); m_menu->addAction(KIcon("document-save"), i18n("Save Effect"), this, SLOT(slotSaveEffect())); QDomElement namenode = m_effect.firstChildElement("name"); if (namenode.isNull()) return; - title->setText(i18n(namenode.text().toUtf8().data())); + QString effectname = i18n(namenode.text().toUtf8().data()); + if (m_regionEffect) effectname.append(":" + KUrl(EffectsList::parameter(m_effect, "resource")).fileName()); + title->setText(effectname); /* * Do not show icon, makes too much visual noise QString type = m_effect.attribute("type", QString()); @@ -167,7 +176,10 @@ CollapsibleEffect::CollapsibleEffect(QDomElement effect, QDomElement original_ef else icon = KIcon("kdenlive-show-video"); effecticon->setPixmap(icon.pixmap(16,16));*/ - m_menu->addAction(KIcon("folder-new"), i18n("Create Group"), this, SLOT(slotCreateGroup())); + if (!m_regionEffect) { + m_menu->addAction(KIcon("folder-new"), i18n("Create Group"), this, SLOT(slotCreateGroup())); + m_menu->addAction(KIcon("folder-new"), i18n("Create Region"), this, SLOT(slotCreateRegion())); + } setupWidget(info, metaInfo); setAcceptDrops(true); menuButton->setIcon(KIcon("kdenlive-menu")); @@ -256,6 +268,20 @@ void CollapsibleEffect::slotCreateGroup() emit createGroup(effectIndex()); } +void CollapsibleEffect::slotCreateRegion() +{ + QString allExtensions = ProjectList::getExtensions(); + const QString dialogFilter = allExtensions + ' ' + QLatin1Char('|') + i18n("All Supported Files") + "\n* " + QLatin1Char('|') + i18n("All Files"); + KFileDialog *d = new KFileDialog(KUrl("kfiledialog:///clipfolder"), dialogFilter, kapp->activeWindow()); + d->setOperationMode(KFileDialog::Opening); + d->setMode(KFile::File); + if (d->exec() == QDialog::Accepted) { + KUrl url = d->selectedUrl(); + if (!url.isEmpty()) emit createRegion(effectIndex(), url); + } + delete d; +} + void CollapsibleEffect::slotUnGroup() { emit unGroup(this); @@ -487,6 +513,7 @@ void CollapsibleEffect::setupWidget(ItemInfo info, EffectMetaInfo *metaInfo) } if (m_effect.attribute("tag") == "region") { + m_regionEffect = true; QVBoxLayout *vbox = new QVBoxLayout(widgetFrame); vbox->setContentsMargins(0, 0, 0, 0); vbox->setSpacing(2); @@ -494,10 +521,11 @@ void CollapsibleEffect::setupWidget(ItemInfo info, EffectMetaInfo *metaInfo) QDomNodeList origin_effects = m_original_effect.elementsByTagName("effect"); QWidget *container = new QWidget(widgetFrame); vbox->addWidget(container); - m_paramWidget = new ParameterContainer(m_effect.toElement(), info, metaInfo, container); + // m_paramWidget = new ParameterContainer(m_effect.toElement(), info, metaInfo, container); for (int i = 0; i < effects.count(); i++) { CollapsibleEffect *coll = new CollapsibleEffect(effects.at(i).toElement(), origin_effects.at(i).toElement(), info, metaInfo, container); m_subParamWidgets.append(coll); + connect(coll, SIGNAL(parameterChanged(const QDomElement, const QDomElement, int)), this , SLOT(slotUpdateRegionEffectParams(const QDomElement, const QDomElement, int))); //container = new QWidget(widgetFrame); vbox->addWidget(coll); //p = new ParameterContainer(effects.at(i).toElement(), info, isEffect, container); @@ -545,6 +573,12 @@ void CollapsibleEffect::updateTimecodeFormat() } } +void CollapsibleEffect::slotUpdateRegionEffectParams(const QDomElement /*old*/, const QDomElement /*e*/, int /*ix*/) +{ + kDebug()<<"// EMIT CHANGE SUBEFFECT.....:"; + emit parameterChanged(m_original_effect, m_effect, effectIndex()); +} + void CollapsibleEffect::slotSyncEffectsPos(int pos) { emit syncEffectsPos(pos); diff --git a/src/effectstack/collapsibleeffect.h b/src/effectstack/collapsibleeffect.h index 530a53e5..07132f1a 100644 --- a/src/effectstack/collapsibleeffect.h +++ b/src/effectstack/collapsibleeffect.h @@ -160,7 +160,10 @@ private slots: void slotEffectDown(); void slotSaveEffect(); void slotCreateGroup(); + void slotCreateRegion(); void slotUnGroup(); + /** @brief A sub effect parameter was changed */ + void slotUpdateRegionEffectParams(const QDomElement /*old*/, const QDomElement /*e*/, int /*ix*/); private: ParameterContainer *m_paramWidget; @@ -174,6 +177,8 @@ private: QMenu *m_menu; QPoint m_clickPoint; EffectInfo m_info; + /** @brief True if this is a region effect, which behaves in a special way, like a group. */ + bool m_regionEffect; protected: virtual void mouseDoubleClickEvent ( QMouseEvent * event ); @@ -202,6 +207,7 @@ signals: void moveEffect(int current_pos, int new_pos, int groupIndex, QString groupName); void unGroup(CollapsibleEffect *); void addEffect(QDomElement e); + void createRegion(int, KUrl); }; diff --git a/src/effectstack/effectstackview2.cpp b/src/effectstack/effectstackview2.cpp index e5984ee0..dc09c99e 100644 --- a/src/effectstack/effectstackview2.cpp +++ b/src/effectstack/effectstackview2.cpp @@ -172,8 +172,7 @@ void EffectStackView2::setupListView() EffectInfo effectInfo; effectInfo.fromString(d.attribute("kdenlive_info")); if (effectInfo.groupIndex >= 0) { - // effect is in a group - + // effect is in a group for (int j = 0; j < vbox1->count(); j++) { CollapsibleGroup *eff = static_cast(vbox1->itemAt(j)->widget()); if (eff->isGroup() && eff->groupIndex() == effectInfo.groupIndex) { @@ -243,6 +242,7 @@ void EffectStackView2::setupListView() connect(currentEffect, SIGNAL(createGroup(int)), this , SLOT(slotCreateGroup(int))); connect(currentEffect, SIGNAL(moveEffect(int,int,int,QString)), this , SLOT(slotMoveEffect(int,int,int,QString))); connect(currentEffect, SIGNAL(addEffect(QDomElement)), this , SLOT(slotAddEffect(QDomElement))); + connect(currentEffect, SIGNAL(createRegion(int,KUrl)), this, SLOT(slotCreateRegion(int,KUrl))); //ui.title->setPixmap(icon.pixmap(QSize(12, 12))); } @@ -625,6 +625,65 @@ void EffectStackView2::slotShowComments() emit showComments(m_ui.buttonShowComments->isChecked()); } +void EffectStackView2::slotCreateRegion(int ix, KUrl url) +{ + QDomElement oldeffect = m_currentEffectList.itemFromIndex(ix); + QDomElement neweffect = oldeffect.cloneNode().toElement(); + QDomElement region = MainWindow::videoEffects.getEffectByTag("region", "region").cloneNode().toElement(); + region.appendChild(region.ownerDocument().importNode(neweffect, true)); + region.setAttribute("kdenlive_ix", ix); + EffectsList::setParameter(region, "resource", url.path()); + if (m_effectMetaInfo.trackMode) + emit updateEffect(NULL, m_trackindex, oldeffect, region, ix,false); + else if (m_clipref) { + emit updateEffect(m_clipref, -1, oldeffect, region, ix, false); + // Make sure the changed effect is currently displayed + //slotSetCurrentEffect(ix); + } + // refresh effect stack + ItemInfo info; + bool isSelected = false; + if (m_effectMetaInfo.trackMode) { + info.track = m_trackInfo.type; + info.cropDuration = GenTime(m_trackInfo.duration, KdenliveSettings::project_fps()); + info.cropStart = GenTime(0); + info.startPos = GenTime(-1); + info.track = 0; + } + else { + info = m_clipref->info(); + } + CollapsibleEffect *current = getEffectByIndex(ix); + m_effects.removeAll(current); + current->setEnabled(false); + m_currentEffectList.removeAt(ix); + m_currentEffectList.insert(region); + current->deleteLater(); + CollapsibleEffect *currentEffect = new CollapsibleEffect(region, m_currentEffectList.itemFromIndex(ix), info, &m_effectMetaInfo, ix == m_currentEffectList.count() - 1, m_ui.container->widget()); + connect(currentEffect, SIGNAL(parameterChanged(const QDomElement, const QDomElement, int)), this , SLOT(slotUpdateEffectParams(const QDomElement, const QDomElement, int))); + if (m_effectMetaInfo.trackMode) { + isSelected = currentEffect->effectIndex() == 1; + } + else { + isSelected = currentEffect->effectIndex() == m_clipref->selectedEffectIndex(); + } + if (isSelected) currentEffect->setActive(true); + m_effects.append(currentEffect); + // TODO: region in group? + //if (group) { + // group->addGroupEffect(currentEffect); + //} else { + QVBoxLayout *vbox = static_cast (m_ui.container->widget()->layout()); + vbox->insertWidget(ix, currentEffect); + //} + + // Check drag & drop + currentEffect->installEventFilter( this ); + + QTimer::singleShot(200, this, SLOT(slotCheckWheelEventFilter())); + +} + void EffectStackView2::slotCreateGroup(int ix) { QDomElement oldeffect = m_currentEffectList.itemFromIndex(ix); diff --git a/src/effectstack/effectstackview2.h b/src/effectstack/effectstackview2.h index 48fa4f42..1c4b5e68 100644 --- a/src/effectstack/effectstackview2.h +++ b/src/effectstack/effectstackview2.h @@ -160,6 +160,9 @@ private slots: /** @brief Create a group containing effect with ix index. */ void slotCreateGroup(int ix); + /** @brief Create a region effect with ix index. */ + void slotCreateRegion(int ix, KUrl url); + /** @brief Move an effect into a group. ** @param ix the index of effect to move in stack layout ** @param group the effect on which the effect was dropped diff --git a/src/trackview.cpp b/src/trackview.cpp index 5e589231..ea8802b0 100644 --- a/src/trackview.cpp +++ b/src/trackview.cpp @@ -793,13 +793,7 @@ void TrackView::slotAddProjectEffects(QDomNodeList effects, QDomElement parentNo } //kDebug() << "+ + CLIP EFF FND: " << effecttag << ", " << effectid << ", " << effectindex; // get effect standard tags - QDomElement clipeffect = MainWindow::customEffects.getEffectByTag(QString(), effectid); - if (clipeffect.isNull()) { - clipeffect = MainWindow::videoEffects.getEffectByTag(effecttag, effectid); - } - if (clipeffect.isNull()) { - clipeffect = MainWindow::audioEffects.getEffectByTag(effecttag, effectid); - } + QDomElement clipeffect = getEffectByTag(effecttag, effectid); if (clipeffect.isNull()) { kDebug() << "/// WARNING, EFFECT: " << effecttag << ": " << effectid << " not found, removing it from project"; m_documentErrors.append(i18n("Effect %1:%2 not found in MLT, it was removed from this project\n", effecttag, effectid)); @@ -899,50 +893,50 @@ void TrackView::slotAddProjectEffects(QDomNodeList effects, QDomElement parentNo EffectsList::setParameter(currenteffect, "out", effect.attribute("out")); } } - + + // Special case, region filter embeds other effects + bool regionFilter = effecttag == "region"; + QMap regionEffects; + // adjust effect parameters for (QDomNode n3 = effect.firstChild(); !n3.isNull(); n3 = n3.nextSibling()) { // parse effect parameters QDomElement effectparam = n3.toElement(); QString paramname = effectparam.attribute("name"); QString paramvalue = effectparam.text(); - - // try to find this parameter in the effect xml - QDomElement e; - for (int k = 0; k < clipeffectparams.count(); k++) { - e = clipeffectparams.item(k).toElement(); - if (!e.isNull() && e.tagName() == "parameter" && e.attribute("name") == paramname) { - QString type = e.attribute("type"); - QString factor = e.attribute("factor", "1"); - double fact; - if (factor.contains('%')) { - fact = ProfilesDialog::getStringEval(m_doc->mltProfile(), factor); - } else { - fact = factor.toDouble(); - } - double offset = e.attribute("offset", "0").toDouble(); - if (type == "simplekeyframe") { - QStringList kfrs = paramvalue.split(";"); - for (int l = 0; l < kfrs.count(); l++) { - QString fr = kfrs.at(l).section('=', 0, 0); - double val = locale.toDouble(kfrs.at(l).section('=', 1, 1)); - //kfrs[l] = fr + ":" + locale.toString((int)(val * fact)); - kfrs[l] = fr + ":" + QString::number((int) (offset + val * fact)); - } - e.setAttribute("keyframes", kfrs.join(";")); - } else if (type == "double" || type == "constant") { - bool ok; - e.setAttribute("value", offset + locale.toDouble(paramvalue, &ok) * fact); - if (!ok) - e.setAttribute("value", paramvalue); - } else { - e.setAttribute("value", paramvalue); - } - break; - } - } + + if (regionFilter && paramname.startsWith("filter")) { + regionEffects.insert(paramname, paramvalue); + continue; + } + + // try to find this parameter in the effect xml and set its value + adjustparameterValue(clipeffectparams, paramname, paramvalue); + } + if (regionFilter && !regionEffects.isEmpty()) { + // insert region sub-effects + int i = 0; + while (regionEffects.contains(QString("filter%1").arg(i))) { + QString filterid = regionEffects.value(QString("filter%1.kdenlive_id").arg(i)); + QString filtertag = regionEffects.value(QString("filter%1.tag").arg(i)); + QDomElement subclipeffect = getEffectByTag(filtertag, filterid).cloneNode().toElement(); + QDomNodeList subclipeffectparams = subclipeffect.childNodes(); + subclipeffect.setAttribute("region_ix", i); + QMap::const_iterator j = regionEffects.constBegin(); + while (j != regionEffects.constEnd()) { + if (j.key().startsWith(QString("filter%1.").arg(i))) { + QString pname = j.key().section('.', 1, -1); + adjustparameterValue(subclipeffectparams, pname, j.value()); + } + ++j; + } + currenteffect.appendChild(currenteffect.ownerDocument().importNode(subclipeffect, true)); + i++; + } + } + if (disableeffect) currenteffect.setAttribute("disable", "1"); if (clip) clip->addEffect(currenteffect, false); @@ -953,6 +947,58 @@ void TrackView::slotAddProjectEffects(QDomNodeList effects, QDomElement parentNo } +void TrackView::adjustparameterValue(QDomNodeList clipeffectparams, const QString ¶mname, const QString ¶mvalue) +{ + QDomElement e; + QLocale locale; + for (int k = 0; k < clipeffectparams.count(); k++) { + e = clipeffectparams.item(k).toElement(); + if (!e.isNull() && e.tagName() == "parameter" && e.attribute("name") == paramname) { + QString type = e.attribute("type"); + QString factor = e.attribute("factor", "1"); + double fact; + if (factor.contains('%')) { + fact = ProfilesDialog::getStringEval(m_doc->mltProfile(), factor); + } else { + fact = factor.toDouble(); + } + double offset = e.attribute("offset", "0").toDouble(); + if (type == "simplekeyframe") { + QStringList kfrs = paramvalue.split(";"); + for (int l = 0; l < kfrs.count(); l++) { + QString fr = kfrs.at(l).section('=', 0, 0); + double val = locale.toDouble(kfrs.at(l).section('=', 1, 1)); + //kfrs[l] = fr + ":" + locale.toString((int)(val * fact)); + kfrs[l] = fr + ":" + QString::number((int) (offset + val * fact)); + } + e.setAttribute("keyframes", kfrs.join(";")); + } else if (type == "double" || type == "constant") { + bool ok; + e.setAttribute("value", offset + locale.toDouble(paramvalue, &ok) * fact); + if (!ok) + e.setAttribute("value", paramvalue); + } else { + e.setAttribute("value", paramvalue); + } + break; + } + } +} + + +QDomElement TrackView::getEffectByTag(const QString &effecttag, const QString &effectid) +{ + QDomElement clipeffect = MainWindow::customEffects.getEffectByTag(QString(), effectid); + if (clipeffect.isNull()) { + clipeffect = MainWindow::videoEffects.getEffectByTag(effecttag, effectid); + } + if (clipeffect.isNull()) { + clipeffect = MainWindow::audioEffects.getEffectByTag(effecttag, effectid); + } + return clipeffect; +} + + DocClipBase *TrackView::getMissingProducer(const QString id) const { QDomElement missingXml; diff --git a/src/trackview.h b/src/trackview.h index 8d3ff11d..c5992e98 100644 --- a/src/trackview.h +++ b/src/trackview.h @@ -112,6 +112,12 @@ private: void adjustTrackHeaders(); /** @brief Add effects from the xml. Returns true if some effect was upgraded, false if everything went fine.*/ void slotAddProjectEffects(QDomNodeList effects, QDomElement parentNode, ClipItem *clip, int trackIndex); + + /** @brief Returns a kdenlive effect xml description from an effect tag / id */ + QDomElement getEffectByTag(const QString &effecttag, const QString &effectid); + + /** @brief Adjust kdenlive effect xml parameters to the MLT value*/ + void adjustparameterValue(QDomNodeList clipeffectparams, const QString ¶mname, const QString ¶mvalue); private slots: void setCursorPos(int pos); diff --git a/src/widgets/urlval_ui.ui b/src/widgets/urlval_ui.ui index 32445bae..68901f49 100644 --- a/src/widgets/urlval_ui.ui +++ b/src/widgets/urlval_ui.ui @@ -6,8 +6,8 @@ 0 0 - 194 - 42 + 159 + 23 @@ -17,7 +17,10 @@ 0 - + + + + Param @@ -27,9 +30,6 @@ - - - -- 2.39.2