aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Baptiste Mardelle <[email protected]>2015-04-12 20:15:41 +0200
committerJean-Baptiste Mardelle <[email protected]>2015-04-12 20:15:41 +0200
commitce6cc75f7ea057c88b79ef1991d80b1812ed8983 (patch)
tree24ed029286d3bafdc3408c69b3907bc34dd464c2
parent872ff4f1d74b364997b60949accd496e2b4bbf96 (diff)
Bin clip effects can now be edited
-rw-r--r--src/bin/bin.cpp18
-rw-r--r--src/bin/bin.h3
-rw-r--r--src/bin/projectclip.cpp4
-rw-r--r--src/bin/projectclip.h2
-rw-r--r--src/effectstack/effectstackedit.cpp1
-rw-r--r--src/effectstack/effectstackview2.cpp245
-rw-r--r--src/effectstack/effectstackview2.h21
-rw-r--r--src/effectstack/parametercontainer.cpp4
-rw-r--r--src/effectstack/parametercontainer.h9
-rw-r--r--src/mainwindow.cpp15
-rw-r--r--src/mltcontroller/clipcontroller.cpp98
-rw-r--r--src/mltcontroller/clipcontroller.h13
-rw-r--r--src/renderer.cpp15
-rw-r--r--src/renderer.h2
-rw-r--r--src/timeline/customtrackview.cpp8
-rw-r--r--src/timeline/customtrackview.h9
-rw-r--r--src/timeline/trackview.h5
17 files changed, 342 insertions, 130 deletions
diff --git a/src/bin/bin.cpp b/src/bin/bin.cpp
index c5f3817..08de70c 100644
--- a/src/bin/bin.cpp
+++ b/src/bin/bin.cpp
@@ -1487,12 +1487,28 @@ void Bin::removeEffect(const QString &id, const QString &effect)
void Bin::addEffect(const QString &id, const QString &effect)
{
- ProjectClip *currentItem = m_rootFolder->clip(id);
+ QDomDocument doc;
+ doc.setContent(effect);
+ addEffect(id, doc.documentElement());
+}
+
+void Bin::addEffect(const QString &id, const QDomElement &effect)
+{
+ ProjectClip *currentItem = NULL;
+ if (id.isEmpty()) {
+ currentItem = getFirstSelectedClip();
+ }
+ else currentItem = m_rootFolder->clip(id);
if (!currentItem) return;
currentItem->addEffect(effect);
m_monitor->refreshMonitor();
}
+void Bin::editMasterEffect(ClipController *ctl)
+{
+ emit masterClipSelected(ctl, m_monitor);
+}
+
void Bin::doMoveClip(const QString &id, const QString &newParentId)
{
ProjectClip *currentItem = m_rootFolder->clip(id);
diff --git a/src/bin/bin.h b/src/bin/bin.h
index df507be..be003b0 100644
--- a/src/bin/bin.h
+++ b/src/bin/bin.h
@@ -403,6 +403,8 @@ public:
void removeEffect(const QString &id, const QString &effect);
/** @brief Add an effect to a bin clip. */
void addEffect(const QString &id, const QString &effect);
+ void addEffect(const QString &id, const QDomElement &effect);
+ void editMasterEffect(ClipController *ctl);
private slots:
void slotAddClip();
@@ -533,6 +535,7 @@ signals:
void clipNeedsReload(const QString &,bool);
/** @brief Trigger timecode format refresh where needed. */
void refreshTimeCode();
+ void masterClipSelected(ClipController *, Monitor *);
};
#endif
diff --git a/src/bin/projectclip.cpp b/src/bin/projectclip.cpp
index fc86486..66d7b88 100644
--- a/src/bin/projectclip.cpp
+++ b/src/bin/projectclip.cpp
@@ -211,6 +211,7 @@ void ProjectClip::setCurrent(bool current, bool notify)
AbstractProjectItem::setCurrent(current, notify);
if (current && m_controller) {
bin()->openProducer(m_controller);
+ bin()->editMasterEffect(m_controller);
}
}
@@ -565,8 +566,9 @@ void ProjectClip::addMarkers(QList <CommentedTime> &markers)
emit refreshClipDisplay();
}
-void ProjectClip::addEffect(const QString &effect)
+void ProjectClip::addEffect(const QDomElement &effect)
{
m_controller->addEffect(effect);
+ bin()->editMasterEffect(m_controller);
}
diff --git a/src/bin/projectclip.h b/src/bin/projectclip.h
index 95d7596..432653b 100644
--- a/src/bin/projectclip.h
+++ b/src/bin/projectclip.h
@@ -186,7 +186,7 @@ public:
bool deleteClipMarkers(QUndoCommand *groupCommand);
void addMarkers(QList <CommentedTime> &markers);
/** @brief Add an effect to bin clip. */
- void addEffect(const QString &effect);
+ void addEffect(const QDomElement &effect);
public slots:
//TODO
diff --git a/src/effectstack/effectstackedit.cpp b/src/effectstack/effectstackedit.cpp
index a93f189..b06a0ec 100644
--- a/src/effectstack/effectstackedit.cpp
+++ b/src/effectstack/effectstackedit.cpp
@@ -43,7 +43,6 @@ EffectStackEdit::EffectStackEdit(Monitor *monitor, QWidget *parent) :
{
m_baseWidget = new QWidget(this);
m_metaInfo.monitor = monitor;
- m_metaInfo.trackMode = false;
setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
setFrameStyle(QFrame::NoFrame);
diff --git a/src/effectstack/effectstackview2.cpp b/src/effectstack/effectstackview2.cpp
index 76e8c95..861d632 100644
--- a/src/effectstack/effectstackview2.cpp
+++ b/src/effectstack/effectstackview2.cpp
@@ -29,6 +29,7 @@
#include "timeline/clipitem.h"
#include "monitor/monitoreditwidget.h"
#include "monitor/monitorscene.h"
+#include "mltcontroller/clipcontroller.h"
#include <QDebug>
#include <klocalizedstring.h>
@@ -40,17 +41,17 @@
#include <QDrag>
#include <QMimeData>
-EffectStackView2::EffectStackView2(Monitor *monitor, QWidget *parent) :
+EffectStackView2::EffectStackView2(QWidget *parent) :
QWidget(parent),
m_clipref(NULL),
m_trackindex(-1),
m_draggedEffect(NULL),
m_draggedGroup(NULL),
m_groupIndex(0),
- m_monitorSceneWanted(false)
+ m_monitorSceneWanted(false),
+ m_status(EMPTY)
{
- m_effectMetaInfo.trackMode = false;
- m_effectMetaInfo.monitor = monitor;
+ m_effectMetaInfo.monitor = NULL;
m_effects = QList <CollapsibleEffect*>();
setAcceptDrops(true);
@@ -83,7 +84,7 @@ void EffectStackView2::slotRenderPos(int pos)
{
if (m_effects.isEmpty()) return;
if (m_monitorSceneWanted) slotCheckMonitorPosition(pos);
- if (!m_effectMetaInfo.trackMode && m_clipref) pos = pos - m_clipref->startPos().frames(KdenliveSettings::project_fps());
+ if (m_status == TIMELINE_CLIP && m_clipref) pos = pos - m_clipref->startPos().frames(KdenliveSettings::project_fps());
for (int i = 0; i< m_effects.count(); ++i)
m_effects.at(i)->slotSyncEffectsPos(pos);
@@ -98,15 +99,17 @@ void EffectStackView2::slotClipItemUpdate()
}
}
-void EffectStackView2::slotClipItemSelected(ClipItem* c)
+void EffectStackView2::slotClipItemSelected(ClipItem* c, Monitor *m)
{
if (c && !c->isEnabled()) return;
if (c && c == m_clipref) {
} else {
- if (m_clipref) disconnect(m_clipref, SIGNAL(updateRange()), this, SLOT(slotClipItemUpdate()));
+ m_effectMetaInfo.monitor = m;
+ m_masterclipref = NULL;
+ if (m_clipref) disconnect(m_clipref, SIGNAL(updateRange()), this, SLOT(slotClipItemUpdate()));
m_clipref = c;
if (c) {
- connect(m_clipref, SIGNAL(updateRange()), this, SLOT(slotClipItemUpdate()));
+ connect(m_clipref, SIGNAL(updateRange()), this, SLOT(slotClipItemUpdate()));
QString cname = m_clipref->clipName();
if (cname.length() > 30) {
m_ui.checkAll->setToolTip(i18n("Effects for %1", cname));
@@ -131,21 +134,70 @@ void EffectStackView2::slotClipItemSelected(ClipItem* c)
m_effectMetaInfo.monitor->slotShowEffectScene(false);
m_monitorSceneWanted = false;
}
+ m_status = EMPTY;
clear();
return;
}
setEnabled(true);
- m_effectMetaInfo.trackMode = false;
+ m_status = TIMELINE_CLIP;
m_currentEffectList = m_clipref->effectList();
setupListView();
}
-void EffectStackView2::slotTrackItemSelected(int ix, const TrackInfo &info)
+void EffectStackView2::slotMasterClipItemSelected(ClipController* c, Monitor *m)
+{
+ if (c && c == m_masterclipref) {
+ } else {
+ if (!c->hasEffects() && m_status != MASTER_CLIP) {
+ return;
+ }
+ m_masterclipref = c;
+ m_clipref = NULL;
+ m_effectMetaInfo.monitor = m;
+ if (m_masterclipref) {
+ QString cname = m_masterclipref->clipName();
+ if (cname.length() > 30) {
+ m_ui.checkAll->setToolTip(i18n("Bin effects for %1", cname));
+ cname.truncate(27);
+ m_ui.checkAll->setText(i18n("Bin effects for %1", cname) + "...");
+ } else {
+ m_ui.checkAll->setToolTip(QString());
+ m_ui.checkAll->setText(i18n("Bin effects for %1", cname));
+ }
+ m_ui.checkAll->setEnabled(true);
+ //TODO
+ int frameWidth = m_masterclipref->int_property("meta.media.width");
+ int frameHeight = m_masterclipref->int_property("meta.media.height");
+ double factor = m_masterclipref->double_property("aspect_ratio");
+ m_effectMetaInfo.frameSize = QPoint((int)(frameWidth * factor + 0.5), frameHeight);
+ }
+ }
+ if (m_masterclipref == NULL) {
+ //TODO: clear list, reset paramdesc and info
+ // If monitor scene is displayed, hide it
+ if (m_monitorSceneWanted) {
+ m_effectMetaInfo.monitor->slotShowEffectScene(false);
+ m_monitorSceneWanted = false;
+ }
+ m_status = EMPTY;
+ clear();
+ return;
+ }
+ setEnabled(true);
+ m_status = MASTER_CLIP;
+ m_currentEffectList = m_masterclipref->effectList();
+ setupListView();
+}
+
+void EffectStackView2::slotTrackItemSelected(int ix, const TrackInfo &info, Monitor *m)
{
m_clipref = NULL;
- m_effectMetaInfo.trackMode = true;
+ m_status = TIMELINE_TRACK;
+ m_effectMetaInfo.monitor = m;
m_currentEffectList = info.effectsList;
m_trackInfo = info;
+ m_clipref = NULL;
+ m_masterclipref = NULL;
setEnabled(true);
m_ui.checkAll->setToolTip(QString());
m_ui.checkAll->setText(i18n("Effects for track %1", info.trackName.isEmpty() ? QString::number(ix) : info.trackName));
@@ -179,7 +231,7 @@ void EffectStackView2::setupListView()
int effectsCount = m_currentEffectList.count();
// Make sure we always have one effect selected
- if (!m_effectMetaInfo.trackMode) {
+ if (m_status == TIMELINE_CLIP) {
int selectedEffect = m_clipref->selectedEffectIndex();
if (selectedEffect < 1 && effectsCount > 0) m_clipref->setSelectedEffect(1);
else if (selectedEffect > effectsCount) m_clipref->setSelectedEffect(effectsCount);
@@ -220,24 +272,32 @@ void EffectStackView2::setupListView()
ItemInfo info;
bool isSelected = false;
- if (m_effectMetaInfo.trackMode) {
+ if (m_status == TIMELINE_TRACK) {
+ // ?? cleanup following line
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 {
+ } else if (m_status == TIMELINE_CLIP) {
info = m_clipref->info();
+ } else if (m_status == MASTER_CLIP) {
+ info.cropDuration = m_masterclipref->getPlaytime();
+ info.cropStart = GenTime(0);
+ info.startPos = GenTime(0);
}
+
CollapsibleEffect *currentEffect = new CollapsibleEffect(d, m_currentEffectList.at(i), info, &m_effectMetaInfo, i == effectsCount - 1, view);
- if (m_effectMetaInfo.trackMode) {
+ if (m_status == TIMELINE_TRACK) {
isSelected = currentEffect->effectIndex() == 1;
}
- else {
+ else if (m_status == TIMELINE_CLIP) {
isSelected = currentEffect->effectIndex() == m_clipref->selectedEffectIndex();
}
+ else if (m_status == TIMELINE_CLIP) {
+ isSelected = currentEffect->effectIndex() == m_masterclipref->selectedEffectIndex;
+ }
if (isSelected) {
currentEffect->setActive(true);
if (currentEffect->needsMonitorEffectScene()) m_monitorSceneWanted = true;
@@ -382,7 +442,7 @@ void EffectStackView2::startDrag()
QPixmap pixmap;
if (m_draggedEffect) {
QDomElement effect = m_draggedEffect->effect().cloneNode().toElement();
- if (m_effectMetaInfo.trackMode) {
+ if (m_status == TIMELINE_TRACK || m_status == MASTER_CLIP) {
// Keep clip crop start in case we want to paste effect
effect.setAttribute("clipstart", 0);
}
@@ -395,7 +455,7 @@ void EffectStackView2::startDrag()
}
else if (m_draggedGroup) {
doc = m_draggedGroup->effectsData();
- if (m_effectMetaInfo.trackMode) {
+ if (m_status == TIMELINE_TRACK || m_status == MASTER_CLIP) {
doc.documentElement().setAttribute("clipstart", 0);
}
else {
@@ -428,27 +488,37 @@ void EffectStackView2::slotUpdateEffectState(bool disable, int index, bool needs
m_effectMetaInfo.monitor->slotShowEffectScene(true);
m_monitorSceneWanted = true;
}
- if (m_effectMetaInfo.trackMode)
- emit changeEffectState(NULL, m_trackindex, QList <int>() << index, disable);
- else
- emit changeEffectState(m_clipref, -1, QList <int>() <<index, disable);
+ switch (m_status) {
+ case TIMELINE_TRACK:
+ emit changeEffectState(NULL, m_trackindex, QList <int>() << index, disable);
+ break;
+ case MASTER_CLIP:
+ m_masterclipref->changeEffectState(QList <int>() << index, disable);
+ m_effectMetaInfo.monitor->refreshMonitor();
+ break;
+ default:
+ // timeline clip effect
+ emit changeEffectState(m_clipref, -1, QList <int>() <<index, disable);
+ }
slotUpdateCheckAllButton();
}
void EffectStackView2::raiseWindow(QWidget* dock)
{
- if ((m_clipref || m_effectMetaInfo.trackMode) && dock)
+ if (m_status != EMPTY && dock)
dock->raise();
}
void EffectStackView2::slotSeekTimeline(int pos)
{
- if (m_effectMetaInfo.trackMode) {
+ if (m_status == TIMELINE_TRACK) {
emit seekTimeline(pos);
- } else if (m_clipref) {
+ } else if (m_status == TIMELINE_CLIP) {
emit seekTimeline(m_clipref->startPos().frames(KdenliveSettings::project_fps()) + pos);
+ } else if (m_status == MASTER_CLIP) {
+
}
}
@@ -461,7 +531,7 @@ void EffectStackView2::slotSeekTimeline(int pos)
void EffectStackView2::slotCheckMonitorPosition(int renderPos)
{
if (m_monitorSceneWanted) {
- if (m_effectMetaInfo.trackMode || (m_clipref && renderPos >= m_clipref->startPos().frames(KdenliveSettings::project_fps()) && renderPos <= m_clipref->endPos().frames(KdenliveSettings::project_fps()))) {
+ if (m_status == TIMELINE_TRACK || m_status == MASTER_CLIP || (m_clipref && renderPos >= m_clipref->startPos().frames(KdenliveSettings::project_fps()) && renderPos <= m_clipref->endPos().frames(KdenliveSettings::project_fps()))) {
if (!m_effectMetaInfo.monitor->effectSceneDisplayed()) {
m_effectMetaInfo.monitor->slotShowEffectScene(true);
}
@@ -474,9 +544,13 @@ void EffectStackView2::slotCheckMonitorPosition(int renderPos)
}
}
-int EffectStackView2::isTrackMode(bool *ok) const
+EFFECTMODE EffectStackView2::effectStatus() const
+{
+ return m_status;
+}
+
+int EffectStackView2::trackIndex() const
{
- *ok = m_effectMetaInfo.trackMode;
return m_trackindex;
}
@@ -517,10 +591,12 @@ void EffectStackView2::slotCheckAll(int state)
allGroups.at(i)->slotEnable(disabled, false);
}
- if (m_effectMetaInfo.trackMode)
+ if (m_status == TIMELINE_TRACK)
emit changeEffectState(NULL, m_trackindex, indexes, disabled);
- else
+ else if (m_status == TIMELINE_CLIP)
emit changeEffectState(m_clipref, -1, indexes, disabled);
+ else if (m_status == MASTER_CLIP)
+ m_masterclipref->changeEffectState(indexes, disabled);
}
void EffectStackView2::slotUpdateCheckAllButton()
@@ -577,30 +653,36 @@ CollapsibleEffect *EffectStackView2::getEffectByIndex(int ix)
void EffectStackView2::slotUpdateEffectParams(const QDomElement &old, const QDomElement &e, int ix)
{
- if (m_effectMetaInfo.trackMode)
+ if (m_status == TIMELINE_TRACK)
emit updateEffect(NULL, m_trackindex, old, e, ix,false);
- else if (m_clipref) {
+ else if (m_status == TIMELINE_CLIP && m_clipref) {
emit updateEffect(m_clipref, -1, old, e, ix, false);
// Make sure the changed effect is currently displayed
slotSetCurrentEffect(ix);
}
+ else if (m_status == MASTER_CLIP) {
+ m_masterclipref->updateEffect(old, e, ix);
+ m_effectMetaInfo.monitor->refreshMonitor();
+ }
QTimer::singleShot(200, this, SLOT(slotCheckWheelEventFilter()));
}
void EffectStackView2::slotSetCurrentEffect(int ix)
{
- if (m_clipref && ix != m_clipref->selectedEffectIndex()) {
- m_clipref->setSelectedEffect(ix);
- for (int i = 0; i < m_effects.count(); ++i) {
- if (m_effects.at(i)->effectIndex() == ix) {
- if (m_effects.at(i)->isActive()) return;
- m_effects.at(i)->setActive(true);
- m_monitorSceneWanted = m_effects.at(i)->needsMonitorEffectScene();
- slotCheckMonitorPosition(m_effectMetaInfo.monitor->render->seekFramePosition());
- m_ui.labelComment->setText(i18n(m_effects.at(i)->effect().firstChildElement("description").firstChildElement("full").text().toUtf8().data()));
- m_ui.labelComment->setHidden(!m_ui.buttonShowComments->isChecked() || m_ui.labelComment->text().isEmpty());
+ if (m_status == TIMELINE_CLIP) {
+ if (m_clipref && ix != m_clipref->selectedEffectIndex()) {
+ m_clipref->setSelectedEffect(ix);
+ for (int i = 0; i < m_effects.count(); ++i) {
+ if (m_effects.at(i)->effectIndex() == ix) {
+ if (m_effects.at(i)->isActive()) return;
+ m_effects.at(i)->setActive(true);
+ m_monitorSceneWanted = m_effects.at(i)->needsMonitorEffectScene();
+ slotCheckMonitorPosition(m_effectMetaInfo.monitor->render->seekFramePosition());
+ m_ui.labelComment->setText(i18n(m_effects.at(i)->effect().firstChildElement("description").firstChildElement("full").text().toUtf8().data()));
+ m_ui.labelComment->setHidden(!m_ui.buttonShowComments->isChecked() || m_ui.labelComment->text().isEmpty());
+ }
+ else m_effects.at(i)->setActive(false);
}
- else m_effects.at(i)->setActive(false);
}
}
}
@@ -610,10 +692,14 @@ void EffectStackView2::slotDeleteGroup(QDomDocument doc)
QDomNodeList effects = doc.elementsByTagName("effect");
ClipItem * clip = NULL;
int ix;
- if (m_effectMetaInfo.trackMode) {
+ if (m_status == MASTER_CLIP) {
+ //TODO
+ return;
+ }
+ if (m_status == TIMELINE_TRACK) {
ix = m_trackindex;
}
- else {
+ else if (m_status == TIMELINE_CLIP) {
clip = m_clipref;
ix = -1;
}
@@ -624,10 +710,13 @@ void EffectStackView2::slotDeleteGroup(QDomDocument doc)
void EffectStackView2::slotDeleteEffect(const QDomElement &effect)
{
- if (m_effectMetaInfo.trackMode)
+ if (m_status == TIMELINE_TRACK)
emit removeEffect(NULL, m_trackindex, effect);
- else
+ else if (m_status == TIMELINE_CLIP)
emit removeEffect(m_clipref, -1, effect);
+ if (m_status == MASTER_CLIP) {
+ //TODO
+ }
}
void EffectStackView2::slotAddEffect(const QDomElement &effect)
@@ -646,8 +735,11 @@ void EffectStackView2::slotMoveEffectUp(const QList<int> &indexes, bool up)
else {
endPos = indexes.last() + 1;
}
- if (m_effectMetaInfo.trackMode) emit changeEffectPosition(NULL, m_trackindex, indexes, endPos);
- else emit changeEffectPosition(m_clipref, -1, indexes, endPos);
+ if (m_status == TIMELINE_TRACK) emit changeEffectPosition(NULL, m_trackindex, indexes, endPos);
+ else if (m_status == TIMELINE_CLIP) emit changeEffectPosition(m_clipref, -1, indexes, endPos);
+ else if (m_status == MASTER_CLIP) {
+ //TODO
+ }
}
void EffectStackView2::slotStartFilterJob(QMap <QString, QString> &filterParams, QMap <QString, QString> &consumerParams, QMap <QString, QString> &extraParams)
@@ -671,7 +763,7 @@ void EffectStackView2::slotResetEffect(int ix)
}
if (!dom.isNull()) {
dom.setAttribute("kdenlive_ix", old.attribute("kdenlive_ix"));
- if (m_effectMetaInfo.trackMode) {
+ if (m_status == TIMELINE_TRACK) {
EffectsList::setParameter(dom, "in", QString::number(0));
EffectsList::setParameter(dom, "out", QString::number(m_trackInfo.duration));
ItemInfo info;
@@ -687,7 +779,7 @@ void EffectStackView2::slotResetEffect(int ix)
}
}
emit updateEffect(NULL, m_trackindex, old, dom, ix,false);
- } else {
+ } else if (m_status == TIMELINE_CLIP) {
m_clipref->initEffect(dom);
for (int i = 0; i < m_effects.count(); ++i) {
if (m_effects.at(i)->effectIndex() == ix) {
@@ -697,6 +789,8 @@ void EffectStackView2::slotResetEffect(int ix)
}
//m_ui.region_url->setUrl(QUrl(dom.attribute("region")));
emit updateEffect(m_clipref, -1, old, dom, ix,false);
+ } else if (m_status == MASTER_CLIP) {
+ //TODO
}
}
@@ -718,26 +812,33 @@ void EffectStackView2::slotCreateRegion(int ix, QUrl url)
region.appendChild(region.ownerDocument().importNode(neweffect, true));
region.setAttribute("kdenlive_ix", ix);
EffectsList::setParameter(region, "resource", url.path());
- if (m_effectMetaInfo.trackMode)
+ if (m_status == TIMELINE_TRACK) {
emit updateEffect(NULL, m_trackindex, oldeffect, region, ix,false);
- else if (m_clipref) {
+ }
+ else if (m_status == TIMELINE_CLIP && m_clipref) {
emit updateEffect(m_clipref, -1, oldeffect, region, ix, false);
// Make sure the changed effect is currently displayed
//slotSetCurrentEffect(ix);
}
+ else if (m_status == MASTER_CLIP) {
+ //TODO
+ }
// refresh effect stack
ItemInfo info;
bool isSelected = false;
- if (m_effectMetaInfo.trackMode) {
+ if (m_status == TIMELINE_TRACK) {
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 if (m_clipref) {
+ else if (m_status == TIMELINE_CLIP && m_clipref) {
info = m_clipref->info();
}
+ else if (m_status == MASTER_CLIP) {
+ //TODO
+ }
CollapsibleEffect *current = getEffectByIndex(ix);
m_effects.removeAll(current);
current->setEnabled(false);
@@ -747,12 +848,15 @@ void EffectStackView2::slotCreateRegion(int ix, QUrl url)
CollapsibleEffect *currentEffect = new CollapsibleEffect(region, m_currentEffectList.itemFromIndex(ix), info, &m_effectMetaInfo, ix == m_currentEffectList.count() - 1, m_ui.container->widget());
connectEffect(currentEffect);
- if (m_effectMetaInfo.trackMode) {
+ if (m_status == TIMELINE_TRACK) {
isSelected = currentEffect->effectIndex() == 1;
}
- else if (m_clipref) {
+ else if (m_status == TIMELINE_CLIP && m_clipref) {
isSelected = currentEffect->effectIndex() == m_clipref->selectedEffectIndex();
}
+ else if (m_status == MASTER_CLIP) {
+ //TODO
+ }
if (isSelected) currentEffect->setActive(true);
m_effects.append(currentEffect);
// TODO: region in group?
@@ -780,15 +884,17 @@ void EffectStackView2::slotCreateGroup(int ix)
neweffect.setAttribute("kdenlive_info", effectinfo.toString());
ItemInfo info;
- if (m_effectMetaInfo.trackMode) {
+ if (m_status == TIMELINE_TRACK) {
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;
emit updateEffect(NULL, m_trackindex, oldeffect, neweffect, ix, false);
- } else {
+ } else if (m_status == TIMELINE_CLIP) {
emit updateEffect(m_clipref, -1, oldeffect, neweffect, ix, false);
+ } else if (m_status == MASTER_CLIP) {
+ //TODO
}
QVBoxLayout *l = static_cast<QVBoxLayout *>(m_ui.container->widget()->layout());
@@ -841,25 +947,28 @@ void EffectStackView2::slotMoveEffect(QList <int> currentIndexes, int newIndex,
if (oldeffect.attribute("kdenlive_info") != effectinfo.toString()) {
// effect's group info or collapsed state changed
ItemInfo info;
- if (m_effectMetaInfo.trackMode) {
+ if (m_status == TIMELINE_TRACK) {
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;
emit updateEffect(NULL, m_trackindex, oldeffect, neweffect, effectToMove->effectIndex(),false);
- } else {
+ } else if (m_status == TIMELINE_CLIP) {
emit updateEffect(m_clipref, -1, oldeffect, neweffect, effectToMove->effectIndex(),false);
+ } else if (m_status == MASTER_CLIP) {
+ //TODO
}
}
}
// Update effect index with new position
- if (m_effectMetaInfo.trackMode) {
+ if (m_status == TIMELINE_TRACK) {
emit changeEffectPosition(NULL, m_trackindex, currentIndexes, newIndex);
- }
- else {
+ } else if (m_status == TIMELINE_CLIP) {
emit changeEffectPosition(m_clipref, -1, currentIndexes, newIndex);
+ } else if (m_status == MASTER_CLIP) {
+ //TODO
}
}
@@ -878,10 +987,12 @@ void EffectStackView2::slotRenameGroup(CollapsibleGroup *group)
QDomElement origin = effects.at(i)->effect();
QDomElement changed = origin.cloneNode().toElement();
changed.setAttribute("kdenlive_info", effects.at(i)->infoString());
- if (m_effectMetaInfo.trackMode) {
+ if (m_status == TIMELINE_TRACK) {
emit updateEffect(NULL, m_trackindex, origin, changed, effects.at(i)->effectIndex(),false);
- } else {
+ } else if (m_status == TIMELINE_CLIP) {
emit updateEffect(m_clipref, -1, origin, changed, effects.at(i)->effectIndex(),false);
+ } else if (m_status == MASTER_CLIP) {
+ //TODO
}
}
}
diff --git a/src/effectstack/effectstackview2.h b/src/effectstack/effectstackview2.h
index e66e822..1968772 100644
--- a/src/effectstack/effectstackview2.h
+++ b/src/effectstack/effectstackview2.h
@@ -30,6 +30,7 @@
class EffectsList;
class ClipItem;
+class ClipController;
class MltVideoProfile;
class Monitor;
@@ -39,15 +40,16 @@ class EffectStackView2 : public QWidget
Q_OBJECT
public:
- explicit EffectStackView2(Monitor *monitor, QWidget *parent = 0);
+ explicit EffectStackView2(QWidget *parent = 0);
virtual ~EffectStackView2();
/** @brief Raises @param dock if a clip is loaded. */
void raiseWindow(QWidget* dock);
- /** @brief return the index of the track displayed in effect stack
- ** @param ok set to true if we are looking at a track's effects, otherwise false. */
- int isTrackMode(bool *ok) const;
+ /** @brief return the current status of effect stack (timeline clip, track or master clip). */
+ EFFECTMODE effectStatus() const;
+ /** @brief return the index of the track displayed in effect stack */
+ int trackIndex() const;
/** @brief Clears the list of effects and updates the buttons accordingly. */
void clear();
@@ -88,9 +90,12 @@ protected:
private:
Ui::EffectStack2_UI m_ui;
ClipItem* m_clipref;
+ ClipController *m_masterclipref;
QList <CollapsibleEffect*> m_effects;
EffectsList m_currentEffectList;
-
+ /** @brief Current status of the effect stack (if it contains a timeline clip, track or master clip effect. */
+ EFFECTMODE m_status;
+
/** @brief Contains info about effect like is it a track effect, which monitor displays it,... */
EffectMetaInfo m_effectMetaInfo;
@@ -129,13 +134,15 @@ private:
public slots:
/** @brief Sets the clip whose effect list should be managed.
* @param c Clip whose effect list should be managed */
- void slotClipItemSelected(ClipItem* c);
+ void slotClipItemSelected(ClipItem* c, Monitor *m = NULL);
+
+ void slotMasterClipItemSelected(ClipController* c, Monitor *m = NULL);
/** @brief Update the clip range (in-out points)
* @param c Clip whose effect list should be managed */
void slotClipItemUpdate();
- void slotTrackItemSelected(int ix, const TrackInfo &info);
+ void slotTrackItemSelected(int ix, const TrackInfo &info, Monitor *m = NULL);
/** @brief Check if the mouse wheel events should be used for scrolling the widget view. */
void slotCheckWheelEventFilter();
diff --git a/src/effectstack/parametercontainer.cpp b/src/effectstack/parametercontainer.cpp
index d6cd6c5..8345d55 100644
--- a/src/effectstack/parametercontainer.cpp
+++ b/src/effectstack/parametercontainer.cpp
@@ -605,10 +605,10 @@ void ParameterContainer::slotCollectAllParameters()
if (m_effect.attribute("id") == "movit.lift_gamma_gain" || m_effect.attribute("id") == "lift_gamma_gain" ) {
LumaLiftGain *gainWidget = ((LumaLiftGain*)m_valueItems.value(m_effect.attribute("id")));
gainWidget->updateEffect(m_effect);
- emit parameterChanged(oldparam, m_effect, m_effect.attribute("kdenlive_ix").toInt());
+ emit parameterChanged(oldparam, m_effect, m_effect.attribute("kdenlive_ix").toInt());
return;
}
-
+
QDomNodeList namenode = m_effect.elementsByTagName("parameter");
for (int i = 0; i < namenode.count() ; ++i) {
diff --git a/src/effectstack/parametercontainer.h b/src/effectstack/parametercontainer.h
index 26283f0..2d14bb9 100644
--- a/src/effectstack/parametercontainer.h
+++ b/src/effectstack/parametercontainer.h
@@ -25,12 +25,19 @@
class GeometryWidget;
class Monitor;
+enum EFFECTMODE {
+ EMPTY = 0,
+ TIMELINE_CLIP,
+ TIMELINE_TRACK,
+ MASTER_CLIP,
+};
+
struct EffectMetaInfo {
MltVideoProfile profile;
Timecode timecode;
Monitor *monitor;
QPoint frameSize;
- bool trackMode;
+ EFFECTMODE status;
};
enum WIPE_DIRECTON { UP = 0, DOWN = 1, LEFT = 2, RIGHT = 3, CENTER = 4 };
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index b826b46..abf5741 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -196,8 +196,9 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString &
*/
pCore->monitorManager()->initMonitors(m_clipMonitor, m_projectMonitor, m_recMonitor);
- m_effectStack = new EffectStackView2(m_projectMonitor);
+ m_effectStack = new EffectStackView2();
connect(m_effectStack, SIGNAL(startFilterJob(const ItemInfo&,const QString&,QMap<QString,QString>&,QMap<QString,QString>&,QMap<QString,QString>&)), pCore->bin(), SLOT(slotStartFilterJob(const ItemInfo &,const QString&,QMap<QString,QString>&,QMap<QString,QString>&,QMap<QString,QString>&)));
+ connect(pCore->bin(), SIGNAL(masterClipSelected(ClipController *, Monitor *)), m_effectStack, SLOT(slotMasterClipItemSelected(ClipController *, Monitor *)));
m_effectStackDock = addDock(i18n("Effect Stack"), "effect_stack", m_effectStack);
m_transitionConfig = new TransitionSettings(m_projectMonitor);
@@ -613,10 +614,10 @@ void MainWindow::slotAddEffect(const QDomElement &effect)
return;
}
QDomElement effectToAdd = effect.cloneNode().toElement();
- bool ok;
- int ix = m_effectStack->isTrackMode(&ok);
- if (ok) pCore->projectManager()->currentTrackView()->projectView()->slotAddTrackEffect(effectToAdd, pCore->projectManager()->current()->tracksCount() - ix);
- else pCore->projectManager()->currentTrackView()->projectView()->slotAddEffect(effectToAdd, GenTime(), -1);
+ EFFECTMODE status = m_effectStack->effectStatus();
+ if (status == TIMELINE_TRACK) pCore->projectManager()->currentTrackView()->projectView()->slotAddTrackEffect(effectToAdd, pCore->projectManager()->current()->tracksCount() - m_effectStack->trackIndex());
+ else if (status == TIMELINE_CLIP) pCore->projectManager()->currentTrackView()->projectView()->slotAddEffect(effectToAdd, GenTime(), -1);
+ else if (status == MASTER_CLIP) pCore->bin()->addEffect(QString(), effectToAdd);
}
void MainWindow::slotUpdateClip(const QString &id, bool reload)
@@ -2222,7 +2223,7 @@ void MainWindow::slotTimelineClipSelected(ClipItem* item, bool raise)
m_mainClip = item;
}
- m_effectStack->slotClipItemSelected(item);
+ m_effectStack->slotClipItemSelected(item, m_projectMonitor);
m_projectMonitor->slotSetSelectedClip(item);
if (raise) {
m_effectStack->raiseWindow(m_effectStackDock);
@@ -2231,7 +2232,7 @@ void MainWindow::slotTimelineClipSelected(ClipItem* item, bool raise)
void MainWindow::slotTrackSelected(int index, const TrackInfo &info, bool raise)
{
- m_effectStack->slotTrackItemSelected(index, info);
+ m_effectStack->slotTrackItemSelected(index, info, m_projectMonitor);
if (raise) {
m_effectStack->raiseWindow(m_effectStackDock);
}
diff --git a/src/mltcontroller/clipcontroller.cpp b/src/mltcontroller/clipcontroller.cpp
index cebd026..d7d0681 100644
--- a/src/mltcontroller/clipcontroller.cpp
+++ b/src/mltcontroller/clipcontroller.cpp
@@ -22,6 +22,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "clipcontroller.h"
#include "bincontroller.h"
+#include "timeline/customtrackview.h"
+#include "timeline/trackview.h"
+#include "renderer.h"
#include <QUrl>
#include <QDebug>
@@ -34,9 +37,15 @@ ClipController::ClipController(BinController *bincontroller, Mlt::Producer& prod
, m_snapMarkers(QList < CommentedTime >())
, m_hasLimitedDuration(true)
, m_properties(new Mlt::Properties(producer.get_properties()))
+ , selectedEffectIndex(1)
+ , m_effectFreeIndex(1)
{
m_masterProducer = &producer;
- if (!m_masterProducer->is_valid()) qDebug()<<"// WARNING, USING INVALID PRODUCER";
+ m_effectList = EffectsList(true);
+ if (!m_masterProducer->is_valid()) {
+ qDebug()<<"// WARNING, USING INVALID PRODUCER";
+ return;
+ }
else {
QString proxy = m_properties->get("kdenlive:proxy");
if (proxy.length() > 2) {
@@ -46,6 +55,7 @@ ClipController::ClipController(BinController *bincontroller, Mlt::Producer& prod
else m_url = QUrl::fromLocalFile(m_properties->get("resource"));
m_service = m_properties->get("mlt_service");
getInfoForProducer();
+ rebuildEffectList();
}
}
@@ -55,6 +65,7 @@ ClipController::ClipController(BinController *bincontroller) : QObject()
, m_hasLimitedDuration(true)
, m_clipType(Unknown)
, m_properties(NULL)
+ , m_effectFreeIndex(1)
{
m_masterProducer = NULL;
}
@@ -82,6 +93,7 @@ void ClipController::addMasterProducer(Mlt::Producer &producer)
else m_url = QUrl::fromLocalFile(m_properties->get("resource"));
m_service = m_properties->get("mlt_service");
getInfoForProducer();
+ rebuildEffectList();
}
}
@@ -198,6 +210,7 @@ void ClipController::updateProducer(const QString &id, Mlt::Producer* producer)
m_name = m_url.fileName();
}
*/
+ rebuildEffectList();
}
}
@@ -555,27 +568,72 @@ Mlt::Properties &ClipController::properties()
return *m_properties;
}
-void ClipController::addEffect(const QString &effect)
+void ClipController::addEffect(QDomElement effect)
{
- QDomDocument doc;
- doc.setContent(effect);
- QString tag = doc.documentElement().attribute("tag");
- Mlt::Filter *f = new Mlt::Filter(*m_binController->profile(), tag.toUtf8().constData());
- QDomNodeList params = doc.elementsByTagName("parameter");
- QLocale locale;
- qDebug()<<" + ++ ADDING EFFECT: "<<tag<<"\n------";
- for (int j = 0; j < params.count(); ++j) {
- QDomElement e = params.at(j).toElement();
- QString val = e.attribute("value");
- if (val.isEmpty()) val = e.attribute("default");
- if (e.hasAttribute("factor")) {
- double fac = locale.toDouble(e.attribute("factor"));
- double corrected = locale.toDouble(val) / fac;
- val = locale.toString(corrected);
+ Mlt::Service service = m_masterProducer->parent();
+ int ix = m_effectFreeIndex++;
+ effect.setAttribute("kdenlive_ix", QString::number(ix));
+ EffectsParameterList params = CustomTrackView::getEffectArgs(effect);
+ Render::addFilterToService(m_masterProducer->parent(), params, getPlaytime().frames(m_binController->fps()));
+ rebuildEffectList();
+}
+
+EffectsList ClipController::effectList()
+{
+ return m_effectList;
+}
+
+void ClipController::rebuildEffectList()
+{
+ m_effectList.clearList();
+ int ix = 0;
+ Mlt::Service service = m_masterProducer->parent();
+ for (int ix = 0; ix < service.filter_count(); ++ix) {
+ Mlt::Filter *effect = service.filter(ix);
+ QDomElement clipeffect = TrackView::getEffectByTag(effect->get("tag"), effect->get("kdenlive_id"));
+ int curr = effect->get_int("kdenlive_ix");
+ m_effectFreeIndex = qMax(m_effectFreeIndex, curr + 1);
+ QDomElement currenteffect = clipeffect.cloneNode().toElement();
+ //currenteffect.setAttribute("kdenlive_ix", QString::number(ix));
+ m_effectList.append(currenteffect);
+ }
+}
+
+void ClipController::changeEffectState(const QList <int> indexes, bool disable)
+{
+ Mlt::Service service = m_masterProducer->parent();
+ for (int i = 0; i < service.filter_count(); ++i) {
+ Mlt::Filter *effect = service.filter(i);
+ if (effect && effect->is_valid() && indexes.contains(effect->get_int("kdenlive_ix"))) {
+ effect->set("disable", (int) disable);
+ }
+ }
+
+}
+
+void ClipController::updateEffect(const QDomElement &old, const QDomElement &e, int ix)
+{
+ EffectsParameterList params = CustomTrackView::getEffectArgs(e);
+ Mlt::Service service = m_masterProducer->parent();
+ qDebug()<<"updateing effect: "<<ix;
+ for (int i = 0; i < service.filter_count(); ++i) {
+ Mlt::Filter *effect = service.filter(i);
+ if (!effect || !effect->is_valid() || effect->get_int("kdenlive_ix") != ix) continue;
+ service.lock();
+ QString prefix;
+ QString ser = effect->get("mlt_service");
+ qDebug()<<"EFFCT: "<<ser;
+ if (ser == "region") prefix = "filter0.";
+ for (int j = 0; j < params.count(); ++j) {
+ effect->set((prefix + params.at(j).name()).toUtf8().constData(), params.at(j).value().toUtf8().constData());
+ qDebug()<<params.at(j).name()<<" = "<<params.at(j).value();
}
- qDebug()<<" + ++ PARAM: "<<e.attribute("name")<<"="<<val;
- f->set(e.attribute("name").toUtf8().constData(), val.toUtf8().constData());
+ service.unlock();
}
- m_masterProducer->parent().attach(*f);
+}
+
+bool ClipController::hasEffects() const
+{
+ return !m_effectList.isEmpty();
}
diff --git a/src/mltcontroller/clipcontroller.h b/src/mltcontroller/clipcontroller.h
index 2c89d4a..16ed3cf 100644
--- a/src/mltcontroller/clipcontroller.h
+++ b/src/mltcontroller/clipcontroller.h
@@ -137,7 +137,8 @@ public:
/** @brief Returns the current profile's display aspect ratio. */
double dar() const;
-
+ /** @brief Holds index of currently selected master clip effect. */
+ int selectedEffectIndex;
/** @brief Get a clone of master producer for a specific track. Retrieve it if it already exists
* in our list, otherwise we create it. */
Mlt::Producer *getTrackProducer(const QString trackName, PlaylistState::ClipState clipState = PlaylistState::Original, double speed = 1.0);
@@ -159,17 +160,24 @@ public:
QPoint zone() const;
bool hasLimitedDuration() const;
Mlt::Properties &properties();
- void addEffect(const QString &effect);
+ void addEffect(QDomElement effect);
+ EffectsList effectList();
+ /** @brief Enable/disable an effect. */
+ void changeEffectState(const QList <int> indexes, bool disable);
+ void updateEffect(const QDomElement &old, const QDomElement &e, int ix);
+ bool hasEffects() const;
private:
Mlt::Producer *m_masterProducer;
Mlt::Properties *m_properties;
+ EffectsList m_effectList;
QString m_service;
QUrl m_url;
int m_audioIndex;
int m_videoIndex;
ClipType m_clipType;
bool m_hasLimitedDuration;
+ int m_effectFreeIndex;
BinController *m_binController;
/** @brief A list of snap markers; these markers are added to a clips snap-to points, and are displayed as necessary. */
QList < CommentedTime > m_snapMarkers;
@@ -177,6 +185,7 @@ private:
* this method returns a list of properties that we want to keep when replacing a producer . */
const char *getPassPropertiesList() const;
void getInfoForProducer();
+ void rebuildEffectList();
};
#endif
diff --git a/src/renderer.cpp b/src/renderer.cpp
index a70b9f6..f2d7c46 100644
--- a/src/renderer.cpp
+++ b/src/renderer.cpp
@@ -3008,11 +3008,12 @@ bool Render::mltAddEffect(Mlt::Service service, EffectsParameterList params, int
return success;
}
-
+// static
bool Render::addFilterToService(Mlt::Service service, EffectsParameterList params, int duration)
{
// create filter
QString tag = params.paramValue("tag");
+ QLocale locale;
////qDebug() << " / / INSERTING EFFECT: " << tag << ", REGI: " << region;
QString kfr = params.paramValue("keyframes");
if (!kfr.isEmpty()) {
@@ -3034,7 +3035,7 @@ bool Render::addFilterToService(Mlt::Service service, EffectsParameterList param
params.removeParam("offset");
// Special case, only one keyframe, means we want a constant value
if (keyFrames.count() == 1) {
- Mlt::Filter *filter = new Mlt::Filter(*m_mltProfile, qstrdup(tag.toUtf8().constData()));
+ Mlt::Filter *filter = new Mlt::Filter(*service.profile(), qstrdup(tag.toUtf8().constData()));
if (filter && filter->is_valid()) {
filter->set("kdenlive_id", qstrdup(params.paramValue("id").toUtf8().constData()));
int x1 = keyFrames.at(0).section('=', 0, 0).toInt();
@@ -3044,7 +3045,7 @@ bool Render::addFilterToService(Mlt::Service service, EffectsParameterList param
}
filter->set("in", x1);
////qDebug() << "// ADDING KEYFRAME vals: " << min<<" / "<<max<<", "<<y1<<", factor: "<<factor;
- filter->set(starttag, m_locale.toString(((min + y1) - paramOffset) / factor).toUtf8().data());
+ filter->set(starttag, locale.toString(((min + y1) - paramOffset) / factor).toUtf8().data());
service.attach(*filter);
} else {
delete[] starttag;
@@ -3054,7 +3055,7 @@ bool Render::addFilterToService(Mlt::Service service, EffectsParameterList param
return false;
}
} else for (int i = 0; i < keyFrames.size() - 1; ++i) {
- Mlt::Filter *filter = new Mlt::Filter(*m_mltProfile, qstrdup(tag.toUtf8().constData()));
+ Mlt::Filter *filter = new Mlt::Filter(*service.profile(), qstrdup(tag.toUtf8().constData()));
if (filter && filter->is_valid()) {
filter->set("kdenlive_id", qstrdup(params.paramValue("id").toUtf8().constData()));
int x1 = keyFrames.at(i).section('=', 0, 0).toInt();
@@ -3070,8 +3071,8 @@ bool Render::addFilterToService(Mlt::Service service, EffectsParameterList param
filter->set("in", x1);
filter->set("out", x2);
////qDebug() << "// ADDING KEYFRAME vals: " << min<<" / "<<max<<", "<<y1<<", factor: "<<factor;
- filter->set(starttag, m_locale.toString(((min + y1) - paramOffset) / factor).toUtf8().data());
- filter->set(endtag, m_locale.toString(((min + y2) - paramOffset) / factor).toUtf8().data());
+ filter->set(starttag, locale.toString(((min + y1) - paramOffset) / factor).toUtf8().data());
+ filter->set(endtag, locale.toString(((min + y2) - paramOffset) / factor).toUtf8().data());
service.attach(*filter);
} else {
delete[] starttag;
@@ -3086,7 +3087,7 @@ bool Render::addFilterToService(Mlt::Service service, EffectsParameterList param
} else {
Mlt::Filter *filter;
QString prefix;
- filter = new Mlt::Filter(*m_mltProfile, qstrdup(tag.toUtf8().constData()));
+ filter = new Mlt::Filter(*service.profile(), qstrdup(tag.toUtf8().constData()));
if (filter && filter->is_valid()) {
filter->set("kdenlive_id", qstrdup(params.paramValue("id").toUtf8().constData()));
} else {
diff --git a/src/renderer.h b/src/renderer.h
index f429642..3ca0aee 100644
--- a/src/renderer.h
+++ b/src/renderer.h
@@ -233,7 +233,7 @@ class Render: public AbstractRender
/** @brief Adds an effect to a clip in MLT's playlist. */
bool mltAddEffect(int track, GenTime position, EffectsParameterList params, bool doRefresh = true);
- bool addFilterToService(Mlt::Service service, EffectsParameterList params, int duration);
+ static bool addFilterToService(Mlt::Service service, EffectsParameterList params, int duration);
bool mltAddEffect(Mlt::Service service, EffectsParameterList params, int duration, bool doRefresh);
bool mltAddTrackEffect(int track, EffectsParameterList params);
diff --git a/src/timeline/customtrackview.cpp b/src/timeline/customtrackview.cpp
index fb46f37..182380b 100644
--- a/src/timeline/customtrackview.cpp
+++ b/src/timeline/customtrackview.cpp
@@ -7281,17 +7281,17 @@ EffectsParameterList CustomTrackView::getEffectArgs(const QDomElement &effect)
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, m_document->mltProfile(), QString("filter%1.").arg(subeffectix));
+ adjustEffectParameters(parameters, subparams, MltVideoProfile()/*m_document->mltProfile()*/, QString("filter%1.").arg(subeffectix));
}
}
QDomNodeList params = effect.elementsByTagName("parameter");
- adjustEffectParameters(parameters, params, m_document->mltProfile());
+ adjustEffectParameters(parameters, params/*, m_document->mltProfile()*/);
return parameters;
}
-
+// static
void CustomTrackView::adjustEffectParameters(EffectsParameterList &parameters, QDomNodeList params, MltVideoProfile profile, const QString &prefix)
{
QLocale locale;
@@ -7343,7 +7343,7 @@ void CustomTrackView::adjustEffectParameters(EffectsParameterList &parameters, Q
} else {
if (e.attribute("factor", "1") != "1" || e.attribute("offset", "0") != "0") {
double fact;
- if (e.attribute("factor").contains('%')) {
+ if (e.attribute("factor").contains('%') && profile.width > 0) {
fact = ProfilesDialog::getStringEval(profile, e.attribute("factor"));
} else {
fact = e.attribute("factor", "1").toDouble();
diff --git a/src/timeline/customtrackview.h b/src/timeline/customtrackview.h
index 35350e0..225c993 100644
--- a/src/timeline/customtrackview.h
+++ b/src/timeline/customtrackview.h
@@ -208,7 +208,7 @@ public:
int getMousePos() const;
/** @brief Get effect parameters ready for MLT*/
- static void adjustEffectParameters(EffectsParameterList &parameters, QDomNodeList params, MltVideoProfile profile, const QString &prefix = QString());
+ static void adjustEffectParameters(EffectsParameterList &parameters, QDomNodeList params, MltVideoProfile profile = MltVideoProfile(), const QString &prefix = QString());
void completeSpaceOperation(int track, GenTime &timeOffset);
void spaceToolMoveToSnapPos(double snappedPos);
@@ -221,6 +221,8 @@ public:
void resetSelectionGroup(bool selectItems = true);
/** @brief Returns all infos necessary to save guides. */
QMap <double, QString> guidesData() const;
+ /** @brief Gets the effect parameters that will be passed to Mlt. */
+ static EffectsParameterList getEffectArgs(const QDomElement &effect);
public slots:
/** @brief Send seek request to MLT. */
@@ -303,7 +305,7 @@ public slots:
/** @brief Move playhead to mouse curser position if defined key is pressed */
void slotAlignPlayheadToMousePos();
-
+
void slotInfoProcessingFinished();
void slotAlignClip(int, int, int);
@@ -454,9 +456,6 @@ private:
* @param cutPos The absolute position of the cut */
void razorGroup(AbstractGroupItem *group, GenTime cutPos);
- /** @brief Gets the effect parameters that will be passed to Mlt. */
- EffectsParameterList getEffectArgs(const QDomElement &effect);
-
/** @brief Update Tracknames to fit again after track was added/deleted.
* @param track Number of track which was added/deleted
* @param added true = track added, false = track deleted
diff --git a/src/timeline/trackview.h b/src/timeline/trackview.h
index 9efee4b..fcca7f4 100644
--- a/src/timeline/trackview.h
+++ b/src/timeline/trackview.h
@@ -79,6 +79,8 @@ public:
void checkTrackHeight();
void updateProfile();
void updatePalette();
+ /** @brief Returns a kdenlive effect xml description from an effect tag / id */
+ static QDomElement getEffectByTag(const QString &effecttag, const QString &effectid);
protected:
void keyPressEvent(QKeyEvent * event);
@@ -120,9 +122,6 @@ private:
bool isSlide(QString geometry);
void adjustDouble(QDomElement &e, double value);
-
- /** @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 &paramname, const QString &paramvalue);