]> git.sesse.net Git - kdenlive/commitdiff
Use = instead of : as position/value separator in keyframes.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 16 Jan 2014 20:43:54 +0000 (21:43 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 13 Mar 2014 21:16:54 +0000 (22:16 +0100)
The reason is simple; MLT interprets colons as part of the timecode,
so this messes up keyframing for some effects.

src/clipitem.cpp
src/customtrackview.cpp
src/keyframeedit.cpp
src/renderer.cpp
src/trackview.cpp

index a4d582ff70e96b3b0c99b1744238cff6a19fc626..0e94f1bfd9846abba0107fadddcea1c96251b010 100644 (file)
@@ -263,7 +263,7 @@ void ClipItem::initEffect(QDomElement effect, int diff, int offset)
         if (e.attribute("type") == "keyframe" || e.attribute("type") == "simplekeyframe") {
             if (e.attribute("keyframes").isEmpty()) {
                 // Effect has a keyframe type parameter, we need to set the values
-                e.setAttribute("keyframes", QString::number((int) cropStart().frames(m_fps)) + ':' + e.attribute("default"));
+                e.setAttribute("keyframes", QString::number((int) cropStart().frames(m_fps)) + '=' + e.attribute("default"));
             }
             else if (offset != 0) {
                 // adjust keyframes to this clip
@@ -344,8 +344,8 @@ const QString ClipItem::adjustKeyframes(const QString &keyframes, int offset)
     // Simple keyframes
     const QStringList list = keyframes.split(QLatin1Char(';'), QString::SkipEmptyParts);
     foreach(const QString &keyframe, list) {
-        const int pos = keyframe.section(':', 0, 0).toInt() - offset;
-        const QString newKey = QString::number(pos) + ":" + keyframe.section(':', 1);
+        const int pos = keyframe.section('=', 0, 0).toInt() - offset;
+        const QString newKey = QString::number(pos) + "=" + keyframe.section('=', 1);
         result.append(newKey);
     }
     return result.join(";");
@@ -378,8 +378,8 @@ bool ClipItem::checkKeyFrames(int width, int height, int previousDuration, int c
 
             // go through all keyframes for one param
             foreach(const QString &str, keyframes) {
-                int pos = str.section(':', 0, 0).toInt();
-                double val = locale.toDouble(str.section(':', 1, 1));
+                int pos = str.section('=', 0, 0).toInt();
+                double val = locale.toDouble(str.section('=', 1, 1));
                 if (pos - start < 0) {
                     // a keyframe is defined before the start of the clip
                     cutKeyFrame = true;
@@ -389,7 +389,7 @@ bool ClipItem::checkKeyFrames(int width, int height, int previousDuration, int c
                         int diff = pos - lastPos;
                         double ratio = (double)(start - lastPos) / diff;
                         int newValue = lastValue + (val - lastValue) * ratio;
-                        newKeyFrames.append(QString::number(start) + ':' + QString::number(newValue));
+                        newKeyFrames.append(QString::number(start) + '=' + QString::number(newValue));
                         modified = true;
                     }
                     cutKeyFrame = false;
@@ -401,12 +401,12 @@ bool ClipItem::checkKeyFrames(int width, int height, int previousDuration, int c
                         if (diff != 0) {
                             double ratio = (double)(end - lastPos) / diff;
                             int newValue = lastValue + (val - lastValue) * ratio;
-                            newKeyFrames.append(QString::number(end) + ':' + QString::number(newValue));
+                            newKeyFrames.append(QString::number(end) + '=' + QString::number(newValue));
                             modified = true;
                         }
                         break;
                     } else {
-                        newKeyFrames.append(QString::number(pos) + ':' + QString::number(val));
+                        newKeyFrames.append(QString::number(pos) + '=' + QString::number(val));
                     }
                 }
                 lastPos = pos;
@@ -450,8 +450,8 @@ void ClipItem::setKeyframes(const int ix, const QStringList &keyframes)
                 // 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 = locale.toDouble(str.section(':', 1, 1));
+                    int pos = str.section('=', 0, 0).toInt();
+                    double val = locale.toDouble(str.section('=', 1, 1));
                     m_keyframes[pos] = val;
                 }
                 if (m_keyframes.find(m_editedKeyframe) == m_keyframes.end()) m_editedKeyframe = -1;
@@ -487,8 +487,8 @@ void ClipItem::setSelectedEffect(const int ix)
                 // 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 = locale.toDouble(str.section(':', 1, 1));
+                    int pos = str.section('=', 0, 0).toInt();
+                    double val = locale.toDouble(str.section('=', 1, 1));
                     m_keyframes[pos] = val;
                 }
                 if (m_keyframes.find(m_editedKeyframe) == m_keyframes.end())
@@ -548,7 +548,7 @@ void ClipItem::updateKeyframeEffect()
         if (m_keyframes.count() > 0) {
             QMap<int, int>::const_iterator i = m_keyframes.constBegin();
             while (i != m_keyframes.constEnd()) {
-                keyframes.append(QString::number(i.key()) + ':' + QString::number(i.value()) + ';');
+                keyframes.append(QString::number(i.key()) + '=' + QString::number(i.value()) + ';');
                 ++i;
             }
         }
@@ -1654,8 +1654,8 @@ EffectsParameterList ClipItem::addEffect(QDomElement effect, bool /*animate*/)
                 double offset = e.attribute("offset", "0").toDouble();
                 if (factor != 1 || offset != 0) {
                     for (int j = 0; j < values.count(); j++) {
-                        QString pos = values.at(j).section(':', 0, 0);
-                        double val = (locale.toDouble(values.at(j).section(':', 1, 1)) - offset) / factor;
+                        QString pos = values.at(j).section('=', 0, 0);
+                        double val = (locale.toDouble(values.at(j).section('=', 1, 1)) - offset) / factor;
                         values[j] = pos + '=' + locale.toString(val);
                     }
                 }
@@ -1906,24 +1906,24 @@ void ClipItem::insertKeyframe(QDomElement effect, int pos, int val)
             QStringList newkfr;
             bool added = false;
             foreach(const QString &str, keyframes) {
-                int kpos = str.section(':', 0, 0).toInt();
-                double newval = locale.toDouble(str.section(':', 1, 1));
+                int kpos = str.section('=', 0, 0).toInt();
+                double newval = locale.toDouble(str.section('=', 1, 1));
                 if (kpos < pos) {
                     newkfr.append(str);
                 } else if (!added) {
                     if (i == m_visibleParam)
-                        newkfr.append(QString::number(pos) + ':' + QString::number(val));
+                        newkfr.append(QString::number(pos) + '=' + QString::number(val));
                     else
-                        newkfr.append(QString::number(pos) + ':' + locale.toString(newval));
+                        newkfr.append(QString::number(pos) + '=' + locale.toString(newval));
                     if (kpos > pos) newkfr.append(str);
                     added = true;
                 } else newkfr.append(str);
             }
             if (!added) {
                 if (i == m_visibleParam)
-                    newkfr.append(QString::number(pos) + ':' + QString::number(val));
+                    newkfr.append(QString::number(pos) + '=' + QString::number(val));
                 else
-                    newkfr.append(QString::number(pos) + ':' + e.attribute("default"));
+                    newkfr.append(QString::number(pos) + '=' + e.attribute("default"));
             }
             e.setAttribute("keyframes", newkfr.join(";"));
         }
@@ -1945,15 +1945,15 @@ void ClipItem::movedKeyframe(QDomElement effect, int oldpos, int newpos, double
             const QStringList keyframes = kfr.split(';', QString::SkipEmptyParts);
             QStringList newkfr;
             foreach(const QString &str, keyframes) {
-                if (str.section(':', 0, 0).toInt() != oldpos) {
+                if (str.section('=', 0, 0).toInt() != oldpos) {
                     newkfr.append(str);
                 } else if (newpos != -1) {
                     newpos = qMax(newpos, start);
                     newpos = qMin(newpos, end);
                     if (i == m_visibleParam)
-                        newkfr.append(QString::number(newpos) + ':' + locale.toString(value));
+                        newkfr.append(QString::number(newpos) + '=' + locale.toString(value));
                     else
-                        newkfr.append(QString::number(newpos) + ':' + str.section(':', 1, 1));
+                        newkfr.append(QString::number(newpos) + '=' + str.section('=', 1, 1));
                 }
             }
             e.setAttribute("keyframes", newkfr.join(";"));
@@ -1978,8 +1978,8 @@ void ClipItem::updateKeyframes(QDomElement effect)
     m_limitedKeyFrames = e.attribute("type") == "keyframe";
     const QStringList keyframes = e.attribute("keyframes").split(';', QString::SkipEmptyParts);
     foreach(const QString &str, keyframes) {
-        int pos = str.section(':', 0, 0).toInt();
-        double val = locale.toDouble(str.section(':', 1, 1));
+        int pos = str.section('=', 0, 0).toInt();
+        double val = locale.toDouble(str.section('=', 1, 1));
         m_keyframes[pos] = val;
     }
     if (!m_keyframes.contains(m_selectedKeyframe)) m_selectedKeyframe = -1;
@@ -2090,13 +2090,13 @@ bool ClipItem::updateNormalKeyframes(QDomElement parameter, ItemInfo oldInfo)
     const QStringList data = parameter.attribute("keyframes").split(';', QString::SkipEmptyParts);
     QMap <int, double> keyframes;
     foreach (QString keyframe, data) {
-        int keyframepos = keyframe.section(':', 0, 0).toInt();
+        int keyframepos = keyframe.section('=', 0, 0).toInt();
         // if keyframe was at clip start, update it
         if (keyframepos == oldin) {
             keyframepos = in;
             keyFrameUpdated = true;
         }
-        keyframes[keyframepos] = locale.toDouble(keyframe.section(':', 1, 1));
+        keyframes[keyframepos] = locale.toDouble(keyframe.section('=', 1, 1));
     }
 
 
@@ -2153,7 +2153,7 @@ bool ClipItem::updateNormalKeyframes(QDomElement parameter, ItemInfo oldInfo)
         QString newkfr;
         QMap<int, double>::const_iterator k = keyframes.constBegin();
         while (k != keyframes.constEnd()) {
-            newkfr.append(QString::number(k.key()) + ':' + QString::number(qRound(k.value())) + ';');
+            newkfr.append(QString::number(k.key()) + '=' + QString::number(qRound(k.value())) + ';');
             ++k;
         }
         parameter.setAttribute("keyframes", newkfr);
index 8786d494a07d09a914759dd1b2429f2a0f32f78e..51e119a147b801d3528f5f8551047927e7227ddf 100644 (file)
@@ -6271,13 +6271,13 @@ void CustomTrackView::adjustKeyfames(GenTime oldstart, GenTime newstart, GenTime
             QStringList keys = e.attribute("keyframes").split(';', QString::SkipEmptyParts);
             QStringList newKeyFrames;
             foreach(const QString &str, keys) {
-                int pos = str.section(':', 0, 0).toInt();
-                double val = str.section(':', 1, 1).toDouble();
+                int pos = str.section('=', 0, 0).toInt();
+                double val = str.section('=', 1, 1).toDouble();
                 pos += diff;
                 if (pos > max) {
-                    newKeyFrames.append(QString::number(max) + ':' + locale.toString(val));
+                    newKeyFrames.append(QString::number(max) + '=' + locale.toString(val));
                     break;
-                } else newKeyFrames.append(QString::number(pos) + ':' + locale.toString(val));
+                } else newKeyFrames.append(QString::number(pos) + '=' + locale.toString(val));
             }
             //kDebug()<<"ORIGIN: "<<keys<<", FIXED: "<<newKeyFrames;
             e.setAttribute("keyframes", newKeyFrames.join(";"));
@@ -7611,8 +7611,8 @@ void CustomTrackView::adjustEffectParameters(EffectsParameterList &parameters, Q
             double factor = e.attribute("factor", "1").toDouble();
             double offset = e.attribute("offset", "0").toDouble();
             for (int j = 0; j < values.count(); j++) {
-                QString pos = values.at(j).section(':', 0, 0);
-                double val = (values.at(j).section(':', 1, 1).toDouble() - offset) / factor;
+                QString pos = values.at(j).section('=', 0, 0);
+                double val = (values.at(j).section('=', 1, 1).toDouble() - offset) / factor;
                 values[j] = pos + '=' + locale.toString(val);
             }
             // kDebug() << "/ / / /SENDING KEYFR:" << values;
@@ -7853,21 +7853,21 @@ void CustomTrackView::slotImportClipKeyframes(GraphicsRectItem type)
     if (ui.import_position->isChecked()) {
         if (ui.import_size->isChecked()) {
             foreach(QString key, keyframeList) {
-                if (key.count(':') > 1) result.append(key.section(':', 0, 1));
+                if (key.count('=') > 1) result.append(key.section('=', 0, 1));
                 else result.append(key);
                 result.append(';');
             }
         }
         else {
             foreach(QString key, keyframeList) {
-                result.append(key.section(':', 0, 0));
+                result.append(key.section('=', 0, 0));
                 result.append(';');
             }
         }
     }
     else if (ui.import_size->isChecked()) {
         foreach(QString key, keyframeList) {
-            result.append(key.section(':', 1, 1));
+            result.append(key.section('=', 1, 1));
             result.append(';');
         }
     }
index a7e157ffe86aa8ea0d4176135f1deba95b3a3f20..85965c343cbcef5a7094b1a624db12839eb46ad8 100644 (file)
@@ -128,13 +128,13 @@ void KeyframeEdit::addParameter(const QDomElement &e, int activeKeyframe)
 
     QStringList frames = e.attribute("keyframes").split(';', QString::SkipEmptyParts);
     for (int i = 0; i < frames.count(); ++i) {
-        int frame = frames.at(i).section(':', 0, 0).toInt();
+        int frame = frames.at(i).section('=', 0, 0).toInt();
         bool found = false;
         int j;
         for (j = 0; j < keyframe_list->rowCount(); j++) {
             int currentPos = getPos(j);
             if (frame == currentPos) {
-                keyframe_list->setItem(j, columnId, new QTableWidgetItem(frames.at(i).section(':', 1, 1)));
+                keyframe_list->setItem(j, columnId, new QTableWidgetItem(frames.at(i).section('=', 1, 1)));
                 found = true;
                 break;
             } else if (currentPos > frame) {
@@ -144,7 +144,7 @@ void KeyframeEdit::addParameter(const QDomElement &e, int activeKeyframe)
         if (!found) {
             keyframe_list->insertRow(j);
             keyframe_list->setVerticalHeaderItem(j, new QTableWidgetItem(getPosString(frame)));
-            keyframe_list->setItem(j, columnId, new QTableWidgetItem(frames.at(i).section(':', 1, 1)));
+            keyframe_list->setItem(j, columnId, new QTableWidgetItem(frames.at(i).section('=', 1, 1)));
             keyframe_list->resizeRowToContents(j);
         }
         if ((activeKeyframe > -1) && (activeKeyframe == frame)) {
@@ -251,7 +251,7 @@ void KeyframeEdit::slotGenerateParams(int row, int column)
             QString keyframes;
             for (int i = 0; i < keyframe_list->rowCount(); ++i) {
                 if (keyframe_list->item(i, col))
-                    keyframes.append(QString::number(getPos(i)) + ':' + keyframe_list->item(i, col)->text() + ';');
+                    keyframes.append(QString::number(getPos(i)) + '=' + keyframe_list->item(i, col)->text() + ';');
             }
             m_params[col].setAttribute("keyframes", keyframes);
         }
@@ -289,7 +289,7 @@ void KeyframeEdit::slotGenerateParams(int row, int column)
     QString keyframes;
     for (int i = 0; i < keyframe_list->rowCount(); ++i) {
         if (keyframe_list->item(i, column))
-            keyframes.append(QString::number(getPos(i)) + ':' + keyframe_list->item(i, column)->text() + ';');
+            keyframes.append(QString::number(getPos(i)) + '=' + keyframe_list->item(i, column)->text() + ';');
     }
     m_params[column].setAttribute("keyframes", keyframes);
     emit parameterChanged();
@@ -301,7 +301,7 @@ void KeyframeEdit::generateAllParams()
         QString keyframes;
         for (int i = 0; i < keyframe_list->rowCount(); ++i) {
             if (keyframe_list->item(i, col))
-                keyframes.append(QString::number(getPos(i)) + ':' + keyframe_list->item(i, col)->text() + ';');
+                keyframes.append(QString::number(getPos(i)) + '=' + keyframe_list->item(i, col)->text() + ';');
         }
         m_params[col].setAttribute("keyframes", keyframes);
     }
index 880a9653b21d3171ae16d3946057bb17a3fae283..75cfa7e608f6e295d5a18268c84f1e2a443e0409 100644 (file)
@@ -2963,8 +2963,8 @@ bool Render::addFilterToService(Mlt::Service service, EffectsParameterList param
             Mlt::Filter *filter = new Mlt::Filter(*m_mltProfile, 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();
-                double y1 = keyFrames.at(0).section(':', 1, 1).toDouble();
+                int x1 = keyFrames.at(0).section('=', 0, 0).toInt();
+                double y1 = keyFrames.at(0).section('=', 1, 1).toDouble();
                 for (int j = 0; j < params.count(); j++) {
                     filter->set(params.at(j).name().toUtf8().constData(), params.at(j).value().toUtf8().constData());
                 }
@@ -2983,10 +2983,10 @@ bool Render::addFilterToService(Mlt::Service service, EffectsParameterList param
             Mlt::Filter *filter = new Mlt::Filter(*m_mltProfile, 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() + offset;
-                double y1 = keyFrames.at(i).section(':', 1, 1).toDouble();
-                int x2 = keyFrames.at(i + 1).section(':', 0, 0).toInt();
-                double y2 = keyFrames.at(i + 1).section(':', 1, 1).toDouble();
+                int x1 = keyFrames.at(i).section('=', 0, 0).toInt() + offset;
+                double y1 = keyFrames.at(i).section('=', 1, 1).toDouble();
+                int x2 = keyFrames.at(i + 1).section('=', 0, 0).toInt();
+                double y2 = keyFrames.at(i + 1).section('=', 1, 1).toDouble();
                 if (x2 == -1) x2 = duration;
 
                 for (int j = 0; j < params.count(); j++) {
index 6209421c2d20da64d1a3afc26e7cc104cb2459ca..cffa2a52be08169945b063d557626a4f7999f1bc 100644 (file)
@@ -854,8 +854,8 @@ void TrackView::slotAddProjectEffects(QDomNodeList effects, QDomElement parentNo
                 // add first keyframe
                 if (effectout <= effectin) {
                     // there is only one keyframe
-                    keyframes.append(QString::number(effectin) + ':' + locale.toString(startvalue) + ';');
-                } else keyframes.append(QString::number(effectin) + ':' + locale.toString(startvalue) + ';' + QString::number(effectout) + ':' + QString::number(endvalue) + ';');
+                    keyframes.append(QString::number(effectin) + '=' + locale.toString(startvalue) + ';');
+                } else keyframes.append(QString::number(effectin) + '=' + locale.toString(startvalue) + ';' + QString::number(effectout) + '=' + QString::number(endvalue) + ';');
                 QDomNode lastParsedEffect;
                 ix++;
                 QDomNode n2 = effects.at(ix);
@@ -880,7 +880,7 @@ void TrackView::slotAddProjectEffects(QDomNodeList effects, QDomElement parentNo
                         }
                     }
                     if (continueParsing) {
-                        keyframes.append(QString::number(effectout) + ':' + locale.toString(endvalue) + ';');
+                        keyframes.append(QString::number(effectout) + '=' + locale.toString(endvalue) + ';');
                         ix++;
                     }
                 }
@@ -981,7 +981,7 @@ void TrackView::adjustparameterValue(QDomNodeList clipeffectparams, const QStrin
                     QString fr = kfrs.at(l).section('=', 0, 0);
                     double val = locale.toDouble(kfrs.at(l).section('=', 1, 1));
                     //kfrs[l] = fr + ":" + locale.toString((int)(val * fact));
-                    kfrs[l] = fr + ':' + QString::number((int) (offset + val * fact));
+                    kfrs[l] = fr + '=' + QString::number((int) (offset + val * fact));
                 }
                 e.setAttribute("keyframes", kfrs.join(";"));
             } else if (type == "double" || type == "constant") {