{
m_selectedEffect = ix;
QDomElement effect = effectAt(m_selectedEffect);
- QDomNodeList params = effect.elementsByTagName("parameter");
- if (effect.attribute("disabled") != "1")
- for (int i = 0; i < params.count(); i++) {
- QDomElement e = params.item(i).toElement();
- if (!e.isNull() && e.attribute("type") == "keyframe") {
- m_keyframes.clear();
- double max = e.attribute("max").toDouble();
- double min = e.attribute("min").toDouble();
- m_keyframeFactor = 100.0 / (max - min);
- m_keyframeDefault = e.attribute("default").toDouble();
- // parse keyframes
- const QStringList keyframes = e.attribute("keyframes").split(';', QString::SkipEmptyParts);
- foreach(const QString &str, keyframes) {
- int pos = str.section(':', 0, 0).toInt();
- double val = str.section(':', 1, 1).toDouble();
- m_keyframes[pos] = val;
+ if (effect.isNull() == false) {
+ QDomNodeList params = effect.elementsByTagName("parameter");
+ if (effect.attribute("disabled") != "1")
+ for (int i = 0; i < params.count(); i++) {
+ QDomElement e = params.item(i).toElement();
+ if (!e.isNull() && e.attribute("type") == "keyframe") {
+ m_keyframes.clear();
+ double max = e.attribute("max").toDouble();
+ double min = e.attribute("min").toDouble();
+ m_keyframeFactor = 100.0 / (max - min);
+ m_keyframeDefault = e.attribute("default").toDouble();
+ // parse keyframes
+ const QStringList keyframes = e.attribute("keyframes").split(';', QString::SkipEmptyParts);
+ foreach(const QString &str, keyframes) {
+ int pos = str.section(':', 0, 0).toInt();
+ double val = str.section(':', 1, 1).toDouble();
+ m_keyframes[pos] = val;
+ }
+ update();
+ return;
}
- update();
- return;
}
- }
+ }
if (!m_keyframes.isEmpty()) {
m_keyframes.clear();
update();
update(r);
}
if (m_selectedEffect == -1) {
- m_selectedEffect = 0;
- setSelectedEffect(m_selectedEffect);
+ setSelectedEffect(0);
}
return parameters;
}
}
}
m_effectNames = m_effectList.effectNames().join(" / ");
+ if (m_effectList.isEmpty() || m_selectedEffect - 1 == index.toInt()) {
+ // Current effect was removed
+ if (index.toInt() > m_effectList.count() - 1) {
+ setSelectedEffect(m_effectList.count() - 1);
+ } else setSelectedEffect(index.toInt());
+ return;
+ }
if (needRepaint) update(boundingRect());
flashClip();
}
int count = 0;
for (int i = 0; i < itemList.count(); i++) {
if (itemList.at(i)->type() == AVWIDGET) {
- ClipItem *item = (ClipItem *)itemList.at(i);
+ ClipItem *item = static_cast <ClipItem *>(itemList.at(i));
if (item->hasEffect(effect.attribute("tag"), effect.attribute("id")) != -1 && effect.attribute("unique", "0") != "0") {
emit displayMessage(i18n("Effect already present in clip"), ErrorMessage);
continue;
if (item->isItemLocked()) {
continue;
}
- item->initEffect(effect);
+ QDomElement itemEffect = effect.cloneNode().toElement();
+ item->initEffect(itemEffect);
if (effect.attribute("tag") == "ladspa") {
QString ladpsaFile = m_document->getLadspaFile();
initEffects::ladspaEffectFile(ladpsaFile, effect.attribute("ladspaid").toInt(), getLadspaParams(effect));
- effect.setAttribute("src", ladpsaFile);
+ itemEffect.setAttribute("src", ladpsaFile);
}
- new AddEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), effect, true, effectCommand);
+ new AddEffectCommand(this, m_document->tracksCount() - item->track(), item->startPos(), itemEffect, true, effectCommand);
count++;
}
}