}
}
+void ClipItem::enableEffects(QList <int> indexes, bool disable)
+{
+ m_effectList.enableEffects(indexes, disable);
+}
+
bool ClipItem::moveEffect(QDomElement effect, int ix)
{
if (ix <= 0 || ix > (m_effectList.count()) || effect.isNull()) {
* @param ix The effect's index in effectlist
* @param effect The new effect */
void updateEffect(QDomElement effect);
+ /** @brief Enable / disable a list of effect from their indexes. */
+ void enableEffects(QList <int> indexes, bool disable);
bool moveEffect(QDomElement effect, int ix);
void flashClip();
void addTransition(Transition*);
commands/addtrackcommand.cpp
commands/addtransitioncommand.cpp
commands/changecliptypecommand.cpp
+ commands/changeeffectstatecommand.cpp
commands/changespeedcommand.cpp
commands/configtrackscommand.cpp
commands/editclipcommand.cpp
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+
+#include "changeeffectstatecommand.h"
+#include "customtrackview.h"
+
+#include <KLocale>
+
+ChangeEffectStateCommand::ChangeEffectStateCommand(CustomTrackView *view, const int track, GenTime pos, QList <int> effectIndexes, bool disable, bool refreshEffectStack, bool doIt, QUndoCommand *parent) :
+ QUndoCommand(parent),
+ m_view(view),
+ m_track(track),
+ m_effectIndexes(effectIndexes),
+ m_pos(pos),
+ m_disable(disable),
+ m_doIt(doIt),
+ m_refreshEffectStack(refreshEffectStack)
+{
+ if (disable)
+ setText(i18np("Disable effect", "Disable effects", effectIndexes.count()));
+ else
+ setText(i18np("Enable effect", "Enable effects", effectIndexes.count()));
+}
+
+// virtual
+void ChangeEffectStateCommand::undo()
+{
+ m_view->updateEffectState(m_track, m_pos, m_effectIndexes, !m_disable, true);
+}
+// virtual
+void ChangeEffectStateCommand::redo()
+{
+ if (m_doIt) m_view->updateEffectState(m_track, m_pos, m_effectIndexes, m_disable, m_refreshEffectStack);
+ m_doIt = true;
+ m_refreshEffectStack = true;
+}
+
+
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2007 by Jean-Baptiste Mardelle (jb@kdenlive.org) *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
+ ***************************************************************************/
+
+
+#ifndef CHANGEEFFECTSTATECOMMAND_H
+#define CHANGEEFFECTSTATECOMMAND_H
+
+#include <QUndoCommand>
+#include <KDebug>
+#include <gentime.h>
+#include <QDomElement>
+
+class CustomTrackView;
+
+class ChangeEffectStateCommand : public QUndoCommand
+{
+public:
+ ChangeEffectStateCommand(CustomTrackView *view, const int track, GenTime pos, QList <int> effectIndexes, bool disable, bool refreshEffectStack, bool doIt, QUndoCommand *parent = 0);
+
+ virtual void undo();
+ virtual void redo();
+
+private:
+ CustomTrackView *m_view;
+ const int m_track;
+ QList <int> m_effectIndexes;
+ const GenTime m_pos;
+ bool m_disable;
+ bool m_doIt;
+ bool m_refreshEffectStack;
+};
+
+#endif
+
// virtual
void EditEffectCommand::undo()
{
- m_view->updateEffect(m_track, m_pos, m_oldeffect, m_stackPos, true);
+ m_view->updateEffect(m_track, m_pos, m_oldeffect, true);
}
// virtual
void EditEffectCommand::redo()
{
- if (m_doIt) m_view->updateEffect(m_track, m_pos, m_effect, m_stackPos, m_refreshEffectStack);
+ if (m_doIt) m_view->updateEffect(m_track, m_pos, m_effect, m_refreshEffectStack);
m_doIt = true;
m_refreshEffectStack = true;
}
#include "commands/insertspacecommand.h"
#include "spacerdialog.h"
#include "commands/addtrackcommand.h"
+#include "commands/changeeffectstatecommand.h"
#include "commands/movegroupcommand.h"
#include "ui_addtrack_ui.h"
#include "initeffects.h"
EditEffectCommand *command = new EditEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), oldEffect, newEffect, item->selectedEffectIndex(), false, false);
//EditKeyFrameCommand *command = new EditKeyFrameCommand(this, m_dragItem->track(), m_dragItem->startPos(), item->selectedEffectIndex(), previous, next, false);
m_commandStack->push(command);
- updateEffect(m_document->tracksCount() - item->track(), item->startPos(), item->selectedEffect(), item->selectedEffectIndex());
+ updateEffect(m_document->tracksCount() - item->track(), item->startPos(), item->selectedEffect());
emit clipItemSelected(item, item->selectedEffectIndex());
}
} else if (m_dragItem && !m_dragItem->isItemLocked()) {
setDocumentModified();
}
-void CustomTrackView::updateEffect(int track, GenTime pos, QDomElement insertedEffect, int ix, bool updateEffectStack)
+void CustomTrackView::updateEffect(int track, GenTime pos, QDomElement insertedEffect, bool updateEffectStack)
{
if (insertedEffect.isNull()) {
emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
return;
}
+ int ix = insertedEffect.attribute("kdenlive_ix").toInt();
QDomElement effect = insertedEffect.cloneNode().toElement();
//kDebug() << "// update effect ix: " << effect.attribute("kdenlive_ix")<<", GAIN: "<<EffectsList::parameter(effect, "gain");
if (pos < GenTime()) {
setDocumentModified();
}
+void CustomTrackView::updateEffectState(int track, GenTime pos, QList <int> effectIndexes, bool disable, bool updateEffectStack)
+{
+ if (pos < GenTime()) {
+ // editing a track effect
+ if (!m_document->renderer()->mltEnableEffects(m_document->tracksCount() - track, pos, effectIndexes, disable)) {
+ emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
+ return;
+ }
+ m_document->enableTrackEffects(m_document->tracksCount() - track - 1, effectIndexes, disable);
+ emit updateTrackEffectState(track);
+ setDocumentModified();
+ return;
+ }
+ // editing a clip effect
+ ClipItem *clip = getClipItemAt((int)pos.frames(m_document->fps()), m_document->tracksCount() - track);
+ if (clip) {
+ bool success = m_document->renderer()->mltEnableEffects(m_document->tracksCount() - clip->track(), clip->startPos(), effectIndexes, disable);
+ if (success) {
+ clip->enableEffects(effectIndexes, disable);
+ if (updateEffectStack && clip->isSelected()) {
+ emit clipItemSelected(clip);
+ }
+ if (effectIndexes.contains(clip->selectedEffectIndex())) {
+ // make sure to update display of clip keyframes
+ clip->setSelectedEffect(clip->selectedEffectIndex());
+ }
+ }
+ else emit displayMessage(i18n("Problem editing effect"), ErrorMessage);
+ }
+ else emit displayMessage(i18n("Cannot find clip to update effect"), ErrorMessage);
+}
+
void CustomTrackView::moveEffect(int track, GenTime pos, QList <int> oldPos, QList <int> newPos)
{
if (pos < GenTime()) {
} else emit displayMessage(i18n("Cannot move effect"), ErrorMessage);
}
-void CustomTrackView::slotChangeEffectState(ClipItem *clip, int track, int effectPos, bool disable)
+void CustomTrackView::slotChangeEffectState(ClipItem *clip, int track, QList <int> effectIndexes, bool disable)
{
- EditEffectCommand *command;
- QDomElement effect;
- if (clip == NULL) effect = m_document->getTrackEffect(track - 1, effectPos);
- else effect = clip->effectAt(effectPos);
- QDomElement oldEffect = effect.cloneNode().toElement();
- effect.setAttribute("disable", (int) disable);
-
-
+ ChangeEffectStateCommand *command;
if (clip == NULL) {
// editing track effect
- command = new EditEffectCommand(this, m_document->tracksCount() - track, GenTime(-1), oldEffect, effect, effectPos, false, true);
+ command = new ChangeEffectStateCommand(this, m_document->tracksCount() - track, GenTime(-1), effectIndexes, disable, false, true);
} else {
- command = new EditEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), oldEffect, effect, effectPos, false, true);
+ // Check if we have a speed effect, disabling / enabling it needs a special procedure since it is a pseudoo effect
+ QList <int> speedEffectIndexes;
+ for (int i = 0; i < effectIndexes.count(); i++) {
+ QDomElement effect = clip->effectAt(effectIndexes.at(i));
+ if (effect.attribute("id") == "speed") {
+ // speed effect
+ speedEffectIndexes << effectIndexes.at(i);
+ QDomElement newEffect = effect.cloneNode().toElement();
+ newEffect.setAttribute("disable", (int) disable);
+ EditEffectCommand *editcommand = new EditEffectCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), effect, newEffect, effectIndexes.at(i), false, true);
+ m_commandStack->push(editcommand);
+ }
+ }
+ for (int j = 0; j < speedEffectIndexes.count(); j++) {
+ effectIndexes.removeAll(speedEffectIndexes.at(j));
+ }
+ command = new ChangeEffectStateCommand(this, m_document->tracksCount() - clip->track(), clip->startPos(), effectIndexes, disable, false, true);
}
m_commandStack->push(command);
- setDocumentModified();;
+ setDocumentModified();
}
void CustomTrackView::slotChangeEffectPosition(ClipItem *clip, int track, QList <int> currentPos, int newPos)
EditEffectCommand *command = new EditEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), oldEffect, newEffect, item->selectedEffectIndex(), false, false);
m_commandStack->push(command);
- updateEffect(m_document->tracksCount() - item->track(), item->startPos(), item->selectedEffect(), item->selectedEffectIndex());
+ updateEffect(m_document->tracksCount() - item->track(), item->startPos(), item->selectedEffect());
emit clipItemSelected(item);
}
if (m_dragItem && m_dragItem->type() == TRANSITIONWIDGET && m_dragItem->isSelected()) {
void slotAddGroupEffect(QDomElement effect, AbstractGroupItem *group);
void addEffect(int track, GenTime pos, QDomElement effect);
void deleteEffect(int track, GenTime pos, QDomElement effect);
- void updateEffect(int track, GenTime pos, QDomElement insertedEffect, int ix, bool refreshEffectStack = false);
+ void updateEffect(int track, GenTime pos, QDomElement insertedEffect, bool refreshEffectStack = false);
+ /** @brief Enable / disable a list of effects */
+ void updateEffectState(int track, GenTime pos, QList <int> effectIndexes, bool disable, bool updateEffectStack);
void moveEffect(int track, GenTime pos, QList <int> oldPos, QList <int> newPos);
void addTransition(ItemInfo transitionInfo, int endTrack, QDomElement params, bool refresh);
void deleteTransition(ItemInfo transitionInfo, int endTrack, QDomElement params, bool refresh);
void moveCursorPos(int delta);
void updateCursorPos();
void slotDeleteEffect(ClipItem *clip, int track, QDomElement effect, bool affectGroup = true);
- void slotChangeEffectState(ClipItem *clip, int track, int effectPos, bool disable);
+ void slotChangeEffectState(ClipItem *clip, int track, QList <int> effectIndexes, bool disable);
void slotChangeEffectPosition(ClipItem *clip, int track, QList <int> currentPos, int newPos);
void slotUpdateClipEffect(ClipItem *clip, int track, QDomElement oldeffect, QDomElement effect, int ix, bool refreshEffectStack = true);
void slotUpdateClipRegion(ClipItem *clip, int ix, QString region);
}
}
+void EffectsList::enableEffects(QList <int> indexes, bool disable)
+{
+ QDomNodeList effects = m_baseElement.childNodes();
+ QDomElement effect;
+ for (int i = 0; i < indexes.count(); i++) {
+ effect = effectFromIndex(effects, indexes.at(i));
+ effect.setAttribute("disable", (int) disable);
+ }
+}
+
QDomElement EffectsList::effectFromIndex(QDomNodeList effects, int ix)
{
if (ix <= 0 || ix > effects.count()) return QDomElement();
QDomElement effectFromIndex(QDomNodeList effects, int ix);
/** @brief Update all effects indexes to make sure they are 1, 2, 3, ... */
void updateIndexes(QDomNodeList effects, int startIndex);
+ /** @brief Enable / disable a list of effects */
+ void enableEffects(QList <int> indexes, bool disable);
private:
QDomElement m_baseElement;
QWidget::mouseReleaseEvent(event);
}
-void CollapsibleEffect::slotEnable(bool disable, bool updateMainStatus)
+void CollapsibleEffect::slotEnable(bool disable, bool emitInfo)
{
title->setEnabled(!disable);
enabledButton->blockSignals(true);
if (!disable || KdenliveSettings::disable_effect_parameters()) {
widgetFrame->setEnabled(!disable);
}
- emit effectStateChanged(disable, effectIndex(), updateMainStatus);
+ if (emitInfo) emit effectStateChanged(disable, effectIndex());
}
void CollapsibleEffect::slotDeleteEffect()
public slots:
void slotSyncEffectsPos(int pos);
- void slotEnable(bool enable, bool updateMainStatus = true);
+ void slotEnable(bool enable, bool emitInfo = true);
void slotResetEffect();
private slots:
}
-void CollapsibleGroup::slotEnable(bool disable)
+void CollapsibleGroup::slotEnable(bool disable, bool emitInfo)
{
m_title->setEnabled(!disable);
enabledButton->blockSignals(true);
enabledButton->setIcon(disable ? KIcon("novisible") : KIcon("visible"));
enabledButton->blockSignals(false);
for (int i = 0; i < m_subWidgets.count(); i++)
- m_subWidgets.at(i)->slotEnable(disable);
+ m_subWidgets.at(i)->slotEnable(disable, emitInfo);
}
void CollapsibleGroup::slotDeleteGroup()
void adjustEffects();
public slots:
- void slotEnable(bool enable);
+ void slotEnable(bool enable, bool emitInfo = true);
private slots:
void slotSwitch();
connect(currentEffect, SIGNAL(reloadEffects()), this , SIGNAL(reloadEffects()));
connect(currentEffect, SIGNAL(resetEffect(int)), this , SLOT(slotResetEffect(int)));
connect(currentEffect, SIGNAL(changeEffectPosition(QList <int>,bool)), this , SLOT(slotMoveEffectUp(QList <int>,bool)));
- connect(currentEffect, SIGNAL(effectStateChanged(bool,int,bool)), this, SLOT(slotUpdateEffectState(bool,int,bool)));
+ connect(currentEffect, SIGNAL(effectStateChanged(bool,int)), this, SLOT(slotUpdateEffectState(bool,int)));
connect(currentEffect, SIGNAL(activateEffect(int)), this, SLOT(slotSetCurrentEffect(int)));
connect(currentEffect, SIGNAL(seekTimeline(int)), this , SLOT(slotSeekTimeline(int)));
connect(currentEffect, SIGNAL(createGroup(int)), this , SLOT(slotCreateGroup(int)));
}
-void EffectStackView2::slotUpdateEffectState(bool disable, int index, bool updateMainStatus)
+void EffectStackView2::slotUpdateEffectState(bool disable, int index)
{
if (m_effectMetaInfo.trackMode)
- emit changeEffectState(NULL, m_trackindex, index, disable);
+ emit changeEffectState(NULL, m_trackindex, QList <int>() << index, disable);
else
- emit changeEffectState(m_clipref, -1, index, disable);
- if (updateMainStatus) slotUpdateCheckAllButton();
+ emit changeEffectState(m_clipref, -1, QList <int>() <<index, disable);
+ slotUpdateCheckAllButton();
}
}
bool disabled = state == Qt::Unchecked;
+ // Disable all effects
+ QList <int> indexes;
for (int i = 0; i < m_effects.count(); i++) {
- if (!m_effects.at(i)->isGroup()) {
- m_effects.at(i)->slotEnable(disabled, false);
- }
+ m_effects.at(i)->slotEnable(disabled, false);
+ indexes << m_effects.at(i)->effectIndex();
+ }
+ // Take care of groups
+ QList<CollapsibleGroup *> allGroups = m_ui.container->widget()->findChildren<CollapsibleGroup *>();
+ for (int i = 0; i < allGroups.count(); i++) {
+ allGroups.at(i)->slotEnable(disabled, false);
}
+
+ if (m_effectMetaInfo.trackMode)
+ emit changeEffectState(NULL, m_trackindex, indexes, disabled);
+ else
+ emit changeEffectState(m_clipref, -1, indexes, disabled);
}
void EffectStackView2::slotUpdateCheckAllButton()
void slotRenderPos(int pos);
/** @brief Called whenever an effect is enabled / disabled by user. */
- void slotUpdateEffectState(bool disable, int index, bool updateMainStatus);
+ void slotUpdateEffectState(bool disable, int index);
void slotSetCurrentEffect(int ix);
all effects for this clip in the playlist */
void refreshEffectStack(ClipItem *);
/** Enable or disable an effect */
- void changeEffectState(ClipItem*, int, int, bool);
+ void changeEffectState(ClipItem*, int, QList <int>, bool);
/** An effect in stack was moved */
void changeEffectPosition(ClipItem*, int, QList <int>, int);
/** an effect was saved, reload list */
//m_tracksList[trackIndex].effectsList.updateEffect(effect);
}
+void KdenliveDoc::enableTrackEffects(int trackIndex, QList <int> effectIndexes, bool disable)
+{
+ if (trackIndex < 0 || trackIndex >= m_tracksList.count()) {
+ kWarning() << "Set Track effect outisde of range";
+ return;
+ }
+ EffectsList list = m_tracksList.at(trackIndex).effectsList;
+ QDomElement effect;
+ for (int i = 0; i < effectIndexes.count(); i++) {
+ effect = list.itemFromIndex(effectIndexes.at(i));
+ if (!effect.isNull()) effect.setAttribute("disable", (int) disable);
+ }
+}
+
const EffectsList KdenliveDoc::getTrackEffects(int ix)
{
if (ix < 0 || ix >= m_tracksList.count()) {
void removeTrackEffect(int ix, QDomElement effect);
void setTrackEffect(int trackIndex, int effectIndex, QDomElement effect);
const EffectsList getTrackEffects(int ix);
+ /** @brief Enable / disable an effect in Kdenlive's xml list. */
+ void enableTrackEffects(int trackIndex, QList <int> effectIndexes, bool disable);
QDomElement getTrackEffect(int trackIndex, int effectIndex) const;
/** @brief Check if a track already contains a specific effect. */
int hasTrackEffect(int trackIndex, const QString &tag, const QString &id) const;
disconnect(m_effectStack, SIGNAL(updateEffect(ClipItem*, int, QDomElement, QDomElement, int,bool)), m_activeTimeline->projectView(), SLOT(slotUpdateClipEffect(ClipItem*, int, QDomElement, QDomElement, int,bool)));
disconnect(m_effectStack, SIGNAL(removeEffect(ClipItem*, int, QDomElement)), m_activeTimeline->projectView(), SLOT(slotDeleteEffect(ClipItem*, int, QDomElement)));
disconnect(m_effectStack, SIGNAL(addEffect(ClipItem*, QDomElement)), trackView->projectView(), SLOT(slotAddEffect(ClipItem*, QDomElement)));
- disconnect(m_effectStack, SIGNAL(changeEffectState(ClipItem*, int, int, bool)), m_activeTimeline->projectView(), SLOT(slotChangeEffectState(ClipItem*, int, int, bool)));
+ disconnect(m_effectStack, SIGNAL(changeEffectState(ClipItem*, int, QList <int>, bool)), m_activeTimeline->projectView(), SLOT(slotChangeEffectState(ClipItem*, int, QList <int>, bool)));
disconnect(m_effectStack, SIGNAL(changeEffectPosition(ClipItem*, int, QList<int>, int)), m_activeTimeline->projectView(), SLOT(slotChangeEffectPosition(ClipItem*, int, QList <int>, int)));
disconnect(m_effectStack, SIGNAL(refreshEffectStack(ClipItem*)), m_activeTimeline->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
disconnect(m_effectStack, SIGNAL(reloadEffects()), this, SLOT(slotReloadEffects()));
connect(m_effectStack, SIGNAL(updateClipRegion(ClipItem*, int, QString)), trackView->projectView(), SLOT(slotUpdateClipRegion(ClipItem*, int, QString)));
connect(m_effectStack, SIGNAL(removeEffect(ClipItem*, int, QDomElement)), trackView->projectView(), SLOT(slotDeleteEffect(ClipItem*, int, QDomElement)));
connect(m_effectStack, SIGNAL(addEffect(ClipItem*, QDomElement)), trackView->projectView(), SLOT(slotAddEffect(ClipItem*, QDomElement)));
- connect(m_effectStack, SIGNAL(changeEffectState(ClipItem*, int, int, bool)), trackView->projectView(), SLOT(slotChangeEffectState(ClipItem*, int, int, bool)));
+ connect(m_effectStack, SIGNAL(changeEffectState(ClipItem*, int, QList <int>, bool)), trackView->projectView(), SLOT(slotChangeEffectState(ClipItem*, int, QList <int>, bool)));
connect(m_effectStack, SIGNAL(changeEffectPosition(ClipItem*, int, QList <int>, int)), trackView->projectView(), SLOT(slotChangeEffectPosition(ClipItem*, int, QList <int>, int)));
connect(m_effectStack, SIGNAL(refreshEffectStack(ClipItem*)), trackView->projectView(), SLOT(slotRefreshEffects(ClipItem*)));
connect(m_effectStack, SIGNAL(seekTimeline(int)), trackView->projectView() , SLOT(setCursorPos(int)));
refresh();
return true;
-
}
bool Render::mltEditEffect(int track, GenTime position, EffectsParameterList params)
return true;
}
+bool Render::mltEnableEffects(int track, GenTime position, QList <int> effectIndexes, bool disable)
+{
+ if (position < GenTime()) {
+ return mltEnableTrackEffects(track, effectIndexes, disable);
+ }
+ // find filter
+ Mlt::Service service(m_mltProducer->parent().get_service());
+ Mlt::Tractor tractor(service);
+ Mlt::Producer trackProducer(tractor.track(track));
+ Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service());
+
+ int clipIndex = trackPlaylist.get_clip_index_at((int) position.frames(m_fps));
+ Mlt::Producer *clip = trackPlaylist.get_clip(clipIndex);
+ if (!clip) {
+ kDebug() << "WARINIG, CANNOT FIND CLIP ON track: " << track << ", AT POS: " << position.frames(m_fps);
+ return false;
+ }
+
+ int duration = clip->get_playtime();
+ bool doRefresh = true;
+ // Check if clip is visible in monitor
+ int diff = trackPlaylist.clip_start(clipIndex) + duration - m_mltProducer->position();
+ if (diff < 0 || diff > duration)
+ doRefresh = false;
+ int ct = 0;
+
+ Mlt::Filter *filter = clip->filter(ct);
+ while (filter) {
+ if (effectIndexes.contains(filter->get_int("kdenlive_ix"))) {
+ filter->set("disable", (int) disable);
+ }
+ ct++;
+ filter = clip->filter(ct);
+ }
+
+ delete clip;
+ service.unlock();
+
+ if (doRefresh) refresh();
+ return true;
+}
+
+bool Render::mltEnableTrackEffects(int track, QList <int> effectIndexes, bool disable)
+{
+ Mlt::Service service(m_mltProducer->parent().get_service());
+ Mlt::Tractor tractor(service);
+ Mlt::Producer trackProducer(tractor.track(track));
+ Mlt::Playlist trackPlaylist((mlt_playlist) trackProducer.get_service());
+ Mlt::Service clipService(trackPlaylist.get_service());
+ int ct = 0;
+
+ Mlt::Filter *filter = clipService.filter(ct);
+ while (filter) {
+ if (effectIndexes.contains(filter->get_int("kdenlive_ix"))) {
+ filter->set("disable", (int) disable);
+ }
+ ct++;
+ filter = clipService.filter(ct);
+ }
+ service.unlock();
+
+ refresh();
+ return true;
+}
+
void Render::mltUpdateEffectPosition(int track, GenTime position, int oldPos, int newPos)
{
Mlt::Service service(m_mltProducer->parent().get_service());
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);
+
+ /** @brief Enable / disable clip effects.
+ * @param track The track where the clip is
+ * @param position The start position of the clip
+ * @param effectIndexes The list of effect indexes to enable / disable
+ * @param disable True if effects should be disabled, false otherwise */
+ bool mltEnableEffects(int track, GenTime position, QList <int> effectIndexes, bool disable);
+ /** @brief Enable / disable track effects.
+ * @param track The track where the effect is
+ * @param effectIndexes The list of effect indexes to enable / disable
+ * @param disable True if effects should be disabled, false otherwise */
+ bool mltEnableTrackEffects(int track, QList <int> effectIndexes, bool disable);
/** @brief Edits an effect parameters in MLT's playlist. */
bool mltEditEffect(int track, GenTime position, EffectsParameterList params);