X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fclipitem.cpp;h=958af22d9d0443949fc7b479fd98a7682238e92b;hb=f10ecf3c4538b19705753e118c3bc8c4702d4747;hp=96e489cdce805624bd14b8662ce40ed4f4907af4;hpb=961aeba1758c6d657b404949826f2e1308c3f9ed;p=kdenlive diff --git a/src/clipitem.cpp b/src/clipitem.cpp index 96e489cd..958af22d 100644 --- a/src/clipitem.cpp +++ b/src/clipitem.cpp @@ -104,6 +104,7 @@ int ClipItem::selectedEffectIndex() const { return m_selectedEffect; } + void ClipItem::setSelectedEffect(int ix) { //if (ix == m_selectedEffect) return; m_selectedEffect = ix; @@ -122,19 +123,15 @@ void ClipItem::setSelectedEffect(int ix) { // Effect has a keyframe type parameter, we need to set the values if (e.attribute("keyframes").isEmpty()) { // no keyframes defined, set up 2 keyframes (start and end) with default value. - m_keyframes[0] = 100 * def / (max - min); - m_keyframes[100] = 100 * def / (max - min); + m_keyframes[m_cropStart.frames(m_fps)] = 100 * def / (max - min); + m_keyframes[(m_cropStart + m_cropDuration).frames(m_fps)] = 100 * def / (max - min); } else { // parse keyframes - QStringList keyframes = e.attribute("keyframes").split(";"); + QStringList keyframes = e.attribute("keyframes").split(";", QString::SkipEmptyParts); foreach(QString str, keyframes) { - if (!str.isEmpty()) { - int pos = str.section(":", 0, 0).toInt(); - int val = str.section(":", 1, 1).toInt(); - /*int frame = (int) (pos * 100 / m_cropDuration.frames(m_fps)); - int value = (int) (((val * factor) - min) * 100 * factor / (max - min));*/ - m_keyframes[pos] = val; - } + int pos = str.section(":", 0, 0).toInt(); + double val = str.section(":", 1, 1).toDouble(); + m_keyframes[pos] = val; } } update(); @@ -162,7 +159,7 @@ void ClipItem::updateKeyframeEffect() { QString keyframes; if (m_keyframes.count() > 1) { - QMap::const_iterator i = m_keyframes.constBegin(); + QMap::const_iterator i = m_keyframes.constBegin(); double x1; double y1; while (i != m_keyframes.constEnd()) { @@ -801,8 +798,8 @@ QMap ClipItem::getEffectArgs(QDomElement effect) { effectParams["max"] = e.attribute("max"); effectParams["min"] = e.attribute("min"); effectParams["factor"] = e.attribute("factor"); - effectParams["starttag"] = e.attribute("starttag"); - effectParams["endtag"] = e.attribute("endtag"); + effectParams["starttag"] = e.attribute("starttag", "start"); + effectParams["endtag"] = e.attribute("endtag", "end"); } else if (e.attribute("namedesc").contains(";")) { QString format = e.attribute("format"); QStringList separators = format.split("%d", QString::SkipEmptyParts);