Commit 64357493 authored by Simon Eugster's avatar Simon Eugster

Fix decimal point for animated rect and resource

Related: #713
parent fd8e513f
Pipeline #23384 passed with stage
in 9 minutes and 33 seconds
......@@ -252,7 +252,12 @@ template <typename AssetType> bool AbstractAssetsRepository<AssetType>::parseInf
doc.appendChild(eff);
res.xml = eff;
return true;
} else {
qDebug() << "Invalid title/identifier for " << assetId;
qDebug() << metadata->get("title") << "/" << metadata->get("identifier");
}
} else {
qDebug() << "Metadata for" << assetId << "is invalid.";
}
return false;
}
......
......@@ -129,7 +129,13 @@ AssetParameterModel::AssetParameterModel(std::unique_ptr<Mlt::Properties> asset,
value.prepend(QStringLiteral("%1=").arg(pCore->getItemIn(m_ownerId)));
}
if (!originalDecimalPoint.isEmpty()) {
value.replace(QRegExp("(=\\d+),(\\d+)"), "\\1.\\2");
if (currentRow.type == ParamType::KeyframeParam) {
// Fix values like <position>=1,5
value.replace(QRegExp(R"((=\d+),(\d+))"), "\\1.\\2");
} else {
// Fix values like <position>=50 20 1920 1080 0,75
value.replace(QRegExp(R"((=\d+ \d+ \d+ \d+ \d+),(\d+))"), "\\1.\\2");
}
qDebug() << "Decimal point conversion: " << name << "=" << value;
}
} else if (currentRow.type == ParamType::List) {
......
......@@ -47,7 +47,7 @@ enum class ParamType {
Switch,
RestrictedAnim, // animated 1 dimensional param with linear support only
Animated,
AnimatedRect,
AnimatedRect, // Animated rects have X, Y, width, height, and opacity (in [0,1])
Geometry,
Addedgeometry,
KeyframeParam,
......
......@@ -46,6 +46,7 @@
#include <QStandardPaths>
#include <lib/localeHandling.h>
#include <utility>
DocumentValidator::DocumentValidator(const QDomDocument &doc, QUrl documentUrl)
: m_doc(doc)
, m_url(std::move(documentUrl))
......@@ -1744,12 +1745,23 @@ auto DocumentValidator::upgradeTo100(const QLocale &documentLocale) -> QString {
bool doReplace = propName.endsWith("frame_rate") || (generalPropertiesToFix.indexOf(propName) >= 0);
if (doReplace) {
QString originalValue = text.nodeValue();
QString newValue = QString(originalValue).replace(decimalPoint, '.');
text.setNodeValue(newValue);
bool replaced = true;
QString originalValue = text.nodeValue();
QString value(originalValue);
if (propName == "resource") {
// Fix entries like <property name="resource">0,500000:/path/to/video
value.replace(QRegExp("^(\\d+)" + QString(decimalPoint) + "(\\d+:))"), "\\1.\\2");
} else if (doReplace) {
// Just replace decimal point
value.replace(decimalPoint, '.');
} else {
replaced = false;
}
if (replaced) {
text.setNodeValue(value);
qDebug() << "Decimal separator: Converted " << propName << " from " << originalValue << " to "
<< newValue;
<< value;
}
}
}
......@@ -1766,6 +1778,7 @@ auto DocumentValidator::upgradeTo100(const QLocale &documentLocale) -> QString {
QMap <QString, QList<QString> > servicePropertiesToFix;
servicePropertiesToFix.insert("panner", {"start"});
servicePropertiesToFix.insert("volume", {"level"});
servicePropertiesToFix.insert("lumaliftgaingamma", {"lift", "gain", "gamma"});
// Fix filter properties.
// Note that effect properties will be fixed when the effect is loaded
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment