]> git.sesse.net Git - kdenlive/blobdiff - src/kdenlivedoc.cpp
Add animation feature to Slideshow Clip.
[kdenlive] / src / kdenlivedoc.cpp
index 8615b2bad41800b6ae1f83a8bddf41fb4e86beae..7ea9272a11a01febe267adc656dd95fa6675577a 100644 (file)
@@ -1074,9 +1074,15 @@ void KdenliveDoc::slotCreateColorClip(const QString &name, const QString &color,
     emit selectLastAddedClip(QString::number(m_clipManager->lastClipId()));
 }
 
-void KdenliveDoc::slotCreateSlideshowClipFile(const QString name, const QString path, int count, const QString duration, const bool loop, const bool fade, const QString &luma_duration, const QString &luma_file, const int softness, QString group, const QString &groupId)
-{
-    m_clipManager->slotAddSlideshowClipFile(name, path, count, duration, loop, fade, luma_duration, luma_file, softness, group, groupId);
+void KdenliveDoc::slotCreateSlideshowClipFile(const QString name, const QString path, int count, const QString duration,
+                                              const bool loop, const bool crop, const bool fade,
+                                              const QString &luma_duration, const QString &luma_file, const int softness,
+                                              const QString &animation, QString group, const QString &groupId)
+{
+    m_clipManager->slotAddSlideshowClipFile(name, path, count, duration, loop,
+                                            crop, fade, luma_duration,
+                                            luma_file, softness,
+                                            animation, group, groupId);
     setModified(true);
     emit selectLastAddedClip(QString::number(m_clipManager->lastClipId()));
 }
@@ -1284,6 +1290,32 @@ void KdenliveDoc::addTrackEffect(int ix, QDomElement effect)
         return;
     }
     effect.setAttribute("kdenlive_ix", m_tracksList.at(ix).effectsList.count() + 1);
+
+    // Init parameter value & keyframes if required
+    QDomNodeList params = effect.elementsByTagName("parameter");
+    for (int i = 0; i < params.count(); i++) {
+        QDomElement e = params.item(i).toElement();
+
+        // Check if this effect has a variable parameter
+        if (e.attribute("default").startsWith('%')) {
+            double evaluatedValue = ProfilesDialog::getStringEval(m_profile, e.attribute("default"));
+            e.setAttribute("default", evaluatedValue);
+            if (e.hasAttribute("value") && e.attribute("value").startsWith('%')) {
+                e.setAttribute("value", evaluatedValue);
+            }
+        }
+
+        if (!e.isNull() && (e.attribute("type") == "keyframe" || e.attribute("type") == "simplekeyframe")) {
+            QString def = e.attribute("default");
+            // Effect has a keyframe type parameter, we need to set the values
+            if (e.attribute("keyframes").isEmpty()) {
+                e.setAttribute("keyframes", "0:" + def + ';');
+                kDebug() << "///// EFFECT KEYFRAMES INITED: " << e.attribute("keyframes");
+                //break;
+            }
+        }
+    }
+
     m_tracksList[ix].effectsList.append(effect);
 }