From b19c2585b0ed97a062455337b7a08260cd5177c0 Mon Sep 17 00:00:00 2001 From: Till Theato Date: Thu, 8 Sep 2011 19:55:30 +0000 Subject: [PATCH] Add support for curves version 0.3 svn path=/trunk/kdenlive/; revision=5865 --- effects/frei0r_curves.xml | 65 +++++++++++++++++++++++++++++++-- effects/update/CMakeLists.txt | 1 + effects/update/frei0r.curves.js | 12 ++++++ src/effectstackedit.cpp | 28 +++++++++----- 4 files changed, 93 insertions(+), 13 deletions(-) create mode 100644 effects/update/frei0r.curves.js diff --git a/effects/frei0r_curves.xml b/effects/frei0r_curves.xml index aeb79647..aa9981b6 100644 --- a/effects/frei0r_curves.xml +++ b/effects/frei0r_curves.xml @@ -1,5 +1,6 @@ - + + Curves Color curves adjustment Maksim Golovkin @@ -7,7 +8,7 @@ Red,Green,Blue,Luma Channel - + Rec. 601,Rec. 709 Luma formula @@ -55,4 +56,62 @@ Top Left,Top Right,Bottom Left,Bottom Right Graph position - + + + Curves + Color curves adjustment + Maksim Golovkin + + Red,Green,Blue,Luma + Channel + + + Rec. 601,Rec. 709 + Luma formula + + + + + + + Number of curve points + + + Point 1 input value + + + Point 1 output value + + + Point 2 input value + + + Point 2 output value + + + Point 3 input value + + + Point 3 output value + + + Point 4 input value + + + Point 4 output value + + + Point 5 input value + + + Point 5 output value + + + Show graph in picture + + + Top Left,Top Right,Bottom Left,Bottom Right + Graph position + + + diff --git a/effects/update/CMakeLists.txt b/effects/update/CMakeLists.txt index d69ab9cb..f582223f 100644 --- a/effects/update/CMakeLists.txt +++ b/effects/update/CMakeLists.txt @@ -1,4 +1,5 @@ INSTALL(FILES frei0r.levels.js +frei0r.curves.js DESTINATION ${DATA_INSTALL_DIR}/kdenlive/effects/update) diff --git a/effects/update/frei0r.curves.js b/effects/update/frei0r.curves.js new file mode 100644 index 00000000..240cb481 --- /dev/null +++ b/effects/update/frei0r.curves.js @@ -0,0 +1,12 @@ + +var update = new Object(); + +update["Graph position"] = new Array(new Array(0.2, function(v, d) { return this.upd1(v, d); })); +update["Curve point number"] = update["Graph position"]; + +function upd1(value, isDowngrade) { + if (isDowngrade) + return value * 10; + else + return value / 10.; +} diff --git a/src/effectstackedit.cpp b/src/effectstackedit.cpp index 7ade3c50..00ebba69 100644 --- a/src/effectstackedit.cpp +++ b/src/effectstackedit.cpp @@ -232,9 +232,8 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, ItemInfo info, bool } } #endif - QDomElement e = m_params.toElement(); - int minFrame = e.attribute("start").toInt(); - int maxFrame = e.attribute("end").toInt(); + int minFrame = d.attribute("start").toInt(); + int maxFrame = d.attribute("end").toInt(); // In transitions, maxFrame is in fact one frame after the end of transition if (maxFrame > 0) maxFrame --; @@ -372,14 +371,14 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, ItemInfo info, bool KeyframeEdit *geo; if (pa.attribute("widget") == "corners") { // we want a corners-keyframe-widget - CornersWidget *corners = new CornersWidget(m_monitor, pa, m_in, m_out, m_timecode, e.attribute("active_keyframe", "-1").toInt(), this); + CornersWidget *corners = new CornersWidget(m_monitor, pa, m_in, m_out, m_timecode, d.attribute("active_keyframe", "-1").toInt(), this); corners->slotShowScene(!disable); connect(corners, SIGNAL(checkMonitorPosition(int)), this, SIGNAL(checkMonitorPosition(int))); connect(this, SIGNAL(effectStateChanged(bool)), corners, SLOT(slotShowScene(bool))); connect(this, SIGNAL(syncEffectsPos(int)), corners, SLOT(slotSyncPosition(int))); geo = static_cast(corners); } else { - geo = new KeyframeEdit(pa, m_in, m_out, m_timecode, e.attribute("active_keyframe", "-1").toInt()); + geo = new KeyframeEdit(pa, m_in, m_out, m_timecode, d.attribute("active_keyframe", "-1").toInt()); } m_vbox->addWidget(geo); m_valueItems[paramName+"keyframe"] = geo; @@ -416,7 +415,12 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, ItemInfo info, bool KisCurveWidget *curve = new KisCurveWidget(this); curve->setMaxPoints(pa.attribute("max").toInt()); QList points; - int number = EffectsList::parameter(e, pa.attribute("number")).toInt(); + int number; + if (d.attribute("version").toDouble() > 0.2) { + number = EffectsList::parameter(d, pa.attribute("number")).toDouble() * 10; + } else { + number = EffectsList::parameter(d, pa.attribute("number")).toInt(); + } QString inName = pa.attribute("inpoints"); QString outName = pa.attribute("outpoints"); int start = pa.attribute("min").toInt(); @@ -425,7 +429,7 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, ItemInfo info, bool in.replace("%i", QString::number(j)); QString out = outName; out.replace("%i", QString::number(j)); - points << QPointF(EffectsList::parameter(e, in).toDouble(), EffectsList::parameter(e, out).toDouble()); + points << QPointF(EffectsList::parameter(d, in).toDouble(), EffectsList::parameter(d, out).toDouble()); } if (!points.isEmpty()) curve->setCurve(KisCubicCurve(points)); @@ -443,7 +447,7 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, ItemInfo info, bool QString depends = pa.attribute("depends"); if (!depends.isEmpty()) - meetDependency(paramName, type, EffectsList::parameter(e, depends)); + meetDependency(paramName, type, EffectsList::parameter(d, depends)); } else if (type == "bezier_spline") { BezierSplineWidget *widget = new BezierSplineWidget(value, this); stretch = false; @@ -452,7 +456,7 @@ void EffectStackEdit::transferParamDesc(const QDomElement d, ItemInfo info, bool connect(widget, SIGNAL(modified()), this, SLOT(collectAllParameters())); QString depends = pa.attribute("depends"); if (!depends.isEmpty()) - meetDependency(paramName, type, EffectsList::parameter(e, depends)); + meetDependency(paramName, type, EffectsList::parameter(d, depends)); #ifdef QJSON } else if (type == "roto-spline") { RotoWidget *roto = new RotoWidget(value, m_monitor, info, m_timecode, this); @@ -725,7 +729,11 @@ void EffectStackEdit::collectAllParameters() QString outName = pa.attributes().namedItem("outpoints").nodeValue(); int off = pa.attributes().namedItem("min").nodeValue().toInt(); int end = pa.attributes().namedItem("max").nodeValue().toInt(); - EffectsList::setParameter(newparam, number, QString::number(points.count())); + if (oldparam.attribute("version").toDouble() > 0.2) { + EffectsList::setParameter(newparam, number, locale.toString(points.count() / 10.)); + } else { + EffectsList::setParameter(newparam, number, QString::number(points.count())); + } for (int j = 0; (j < points.count() && j + off <= end); j++) { QString in = inName; in.replace("%i", QString::number(j + off)); -- 2.39.2