Commit 670d5439 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Remember track effect state when disabling timeline effects

BUG: 368245
parent 58cd2707
......@@ -363,17 +363,27 @@ bool EffectManager::removeEffect(int effectIndex, bool updateIndex)
return success;
}
bool EffectManager::enableEffects(const QList <int> &effectIndexes, bool disable)
bool EffectManager::enableEffects(const QList <int> &effectIndexes, bool disable, bool rememberState)
{
int ct = 0;
bool success = false;
Mlt::Filter *filter = m_producer.filter(ct);
while (filter) {
if (effectIndexes.isEmpty() || effectIndexes.contains(filter->get_int("kdenlive_ix"))) {
m_producer.lock();
filter->set("disable", (int) disable);
//m_producer.lock();
if (rememberState) {
if (disable && filter->get_int("disable") == 0) {
filter->set("auto_disable", 1);
filter->set("disable", (int) disable);
} else if (!disable && filter->get_int("auto_disable") == 1) {
filter->set("disable", (char*) NULL);
filter->set("auto_disable", (char*) NULL);
}
} else {
filter->set("disable", (int) disable);
}
success = true;
m_producer.unlock();
//m_producer.unlock();
}
delete filter;
ct++;
......
......@@ -46,7 +46,7 @@ public:
bool doAddFilter(EffectsParameterList params, int duration);
bool editEffect(EffectsParameterList params, int duration, bool replaceEffect);
bool removeEffect(int effectIndex, bool updateIndex);
bool enableEffects(const QList <int> &effectIndexes, bool disable);
bool enableEffects(const QList <int> &effectIndexes, bool disable, bool rememberState = false);
bool moveEffect(int oldPos, int newPos);
public Q_SLOTS:
......
......@@ -862,8 +862,7 @@ int Track::spaceLength(int pos, bool fromBlankStart)
void Track::disableEffects(bool disable)
{
// Disable track effects
enableTrackEffects(QList <int> (), disable);
enableTrackEffects(QList <int> (), disable, true);
// Disable timeline clip effects
for (int i = 0; i < m_playlist.count(); i++) {
QScopedPointer<Mlt::Producer> original(m_playlist.get_clip(i));
......@@ -950,10 +949,10 @@ bool Track::enableEffects(double start, const QList <int> &effectIndexes, bool d
return effect.enableEffects(effectIndexes, disable);
}
bool Track::enableTrackEffects(const QList <int> &effectIndexes, bool disable)
bool Track::enableTrackEffects(const QList <int> &effectIndexes, bool disable, bool remember)
{
EffectManager effect(m_playlist);
return effect.enableEffects(effectIndexes, disable);
return effect.enableEffects(effectIndexes, disable, remember);
}
bool Track::moveEffect(double start, int oldPos, int newPos)
......
......@@ -202,7 +202,7 @@ public:
bool removeEffect(double start, int effectIndex, bool updateIndex);
bool removeTrackEffect(int effectIndex, bool updateIndex);
bool enableEffects(double start, const QList <int> &effectIndexes, bool disable);
bool enableTrackEffects(const QList <int> &effectIndexes, bool disable);
bool enableTrackEffects(const QList <int> &effectIndexes, bool disable, bool remember = false);
bool moveEffect(double start, int oldPos, int newPos);
bool moveTrackEffect(int oldPos, int newPos);
QList <QPoint> visibleClips();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment