Add MLT's Pillar Echo effect

parent 7d0b60c9
Pipeline #29744 passed with stage
in 28 minutes and 30 seconds
......@@ -28,6 +28,7 @@ mute.xml
normalise.xml
oldfilm.xml
pan_zoom.xml
pillar_echo.xml
obscure.xml
region.xml
rotation.xml
......
<!DOCTYPE kpartgui>
<effect tag="pillar_echo" id="pillar_echo">
<name>Pillar Echo</name>
<description>Create an echo effect (blur) outside of an area of interest.</description>
<author>Meltytech, LLC</author>
<parameter type="animatedrect" name="rect" default="25% 0% 50% 100%" fixed="1" opacity="false">
<name>Rectangle</name>
</parameter>
<parameter type="constant" name="blur" max="50" min="0" default="4" suffix="%">
<name>Blur</name>
</parameter>
</effect>
......@@ -544,7 +544,7 @@ ParamType AssetParameterModel::paramTypeFromStr(const QString &type)
return ParamType::Switch;
} else if (type == QLatin1String("simplekeyframe")) {
return ParamType::KeyframeParam;
} else if (type == QLatin1String("animatedrect")) {
} else if (type == QLatin1String("animatedrect") || type == QLatin1String("rect")) {
return ParamType::AnimatedRect;
} else if (type == QLatin1String("geometry")) {
return ParamType::Geometry;
......@@ -628,8 +628,30 @@ QVariant AssetParameterModel::parseAttribute(const ObjectId &owner, const QStrin
.replace(QLatin1String("%height"), QString::number(height))
.replace(QLatin1String("%out"), QString::number(out))
.replace(QLatin1String("%fade"), QString::number(frame_duration));
if (type == ParamType::Double || type == ParamType::Hidden) {
if (type == ParamType::AnimatedRect && attribute == QLatin1String("default")) {
if (content.contains(QLatin1Char('%'))) {
// This is a generic default like: "25% 0% 50% 100%". Parse values
QStringList numbers = content.split(QLatin1Char(' '));
content.clear();
int ix = 0;
for ( QString &val : numbers) {
if (val.endsWith(QLatin1Char('%'))) {
val.chop(1);
double n = val.toDouble()/100.;
if (ix %2 == 0) {
n *= width;
} else {
n *= height;
}
ix++;
content.append(QString("%1 ").arg(qRound(n)));
} else {
content.append(QString("%1 ").arg(val));
}
}
}
}
else if (type == ParamType::Double || type == ParamType::Hidden) {
// Use a Mlt::Properties to parse mathematical operators
Mlt::Properties p;
p.set("eval", content.prepend(QLatin1Char('@')).toLatin1().constData());
......
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