Commit 957e7597 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix affine (Transform) opacity is now in the 0-1 range with MLT7, fix cairo...

Fix affine (Transform) opacity is now in the 0-1 range with MLT7, fix cairo affine blend composition default params
parent 03b4df1f
......@@ -3,7 +3,7 @@
<name context="Affine Transform Transition Name">Transform</name>
<description>Perform an affine transform on for compositing.</description>
<author>Charles Yates</author>
<parameter type="animatedrect" name="rect" default="0 0 %width %height 100">
<parameter type="animatedrect" name="rect" default="0 0 %width %height 1">
<name>Rectangle</name>
</parameter>
<parameter type="keyframe" name="rotate_x" max="1800" min="-1800" default="0" factor="10" notintimeline="1">
......
......@@ -3,32 +3,32 @@
<name>Cairo Affine Blend</name>
<description>Composites second input on first input applying user-defined transformation, opacity and blend mode.</description>
<author>Janne Liljeblad</author>
<parameter type="simplekeyframe" name="0" max="1000" min="0" default="0=400" factor="1000">
<parameter type="simplekeyframe" name="0" max="1000" min="0" default="0.4" factor="1000">
<name>X position</name>
</parameter>
<parameter type="simplekeyframe" name="1" max="1000" min="0" default="0=400" factor="1000">
<parameter type="simplekeyframe" name="1" max="1000" min="0" default="0.4" factor="1000">
<name>Y position</name>
</parameter>
<parameter type="simplekeyframe" name="2" max="5000" min="0" default="0=200" factor="1000">
<parameter type="simplekeyframe" name="2" max="5000" min="0" default="0.2" factor="1000">
<name>X scale</name>
</parameter>
<parameter type="simplekeyframe" name="3" max="5000" min="0" default="0=200" factor="1000">
<parameter type="simplekeyframe" name="3" max="5000" min="0" default="0.2" factor="1000">
<name>Y scale</name>
</parameter>
<parameter type="simplekeyframe" name="4" max="360" min="0" default="0=0" factor="360">
<parameter type="simplekeyframe" name="4" max="360" min="0" default="0" factor="360">
<name>Rotation</name>
</parameter>
<parameter type="simplekeyframe" name="5" max="100" min="0" default="0=100" factor="100">
<parameter type="simplekeyframe" name="5" max="100" min="0" default="100" factor="100">
<name>Opacity</name>
</parameter>
<parameter type="list" name="6" default="normal" paramlist="normal;add;saturate;multiply;screen;overlay;darken;lighten;colordodge;colorburn;hardlight;softlight;difference;exclusion;hslhue;hslsaturation;hslcolor;hslluminosity" >
<paramlistdisplay>Normal,Add,Saturate,Multiply,Screen,Overlay,Darken,Lighten,Color dodge,Color burn,Hard light,Soft light,Difference,Exclusion,HSL hue,HSL saturation,HSL color,HSL luminosity</paramlistdisplay>
<name>Blend mode</name>
</parameter>
<parameter type="constant" name="7" max="1000" min="0" default="0=0" factor="1000">
<parameter type="constant" name="7" max="1000" min="0" default="0" factor="1000">
<name>Rotation X center</name>
</parameter>
<parameter type="constant" name="8" max="1000" min="0" default="0=0" factor="1000">
<parameter type="constant" name="8" max="1000" min="0" default="0" factor="1000">
<name>Rotation Y center</name>
</parameter>
</transition>
......@@ -596,11 +596,6 @@ QVariant KeyframeModel::data(const QModelIndex &index, int role) const
if (!ok) {
qDebug() << "QLocale: Could not convert animated rect opacity" << data;
}
if (auto ptr = m_model.lock()) {
if (ptr->getAssetId() != QLatin1String("qtblend")) {
converted /= 100.;
}
}
return converted;
}
double val = it->second.second.toDouble();
......@@ -1194,7 +1189,7 @@ QString KeyframeModel::realValue(double normalizedValue) const
value *= ptr->data(m_index, AssetParameterModel::FactorRole).toDouble();
QString result;
if (decimals == 0) {
if (ptr->getAssetId() == QLatin1String("qtblend")) {
if (m_paramType == ParamType::AnimatedRect) {
value = qRound(value * 100.);
}
// Fix rounding erros in double > int conversion
......
......@@ -252,11 +252,6 @@ bool KeyframeModelList::updateKeyframe(GenTime oldPos, GenTime pos, const QVaria
if (isRectParam) {
if (normalizedVal.isValid()) {
double newValue = normalizedVal.toDouble();
if (auto ptr = m_model.lock()) {
if (ptr->getAssetId() != QLatin1String("qtblend")) {
newValue *= 100.;
}
}
value = param->getInterpolatedValue(oldPos);
value = param->updateInterpolated(value, newValue);
}
......
......@@ -43,7 +43,7 @@ GeometryEditWidget::GeometryEditWidget(std::shared_ptr<AssetParameterModel> mode
}
Monitor *monitor = pCore->getMonitor(m_model->monitorId);
m_geom = new GeometryWidget(monitor, QPair<int, int>(start, end), rect, 100, frameSize, false,
m_model->data(m_index, AssetParameterModel::OpacityRole).toBool(), true, this);
m_model->data(m_index, AssetParameterModel::OpacityRole).toBool(), this);
m_geom->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred));
connect(m_geom, &GeometryWidget::updateMonitorGeometry, this, [this](const QRect r) {
if (m_model->isActive()) {
......
......@@ -529,9 +529,8 @@ void KeyframeWidget::addParameter(const QPersistentModelIndex &index)
}
}
// qtblend uses an opacity value in the (0-1) range, while older geometry effects use (0-100)
bool integerOpacity = m_model->getAssetId() != QLatin1String("qtblend");
GeometryWidget *geomWidget = new GeometryWidget(pCore->getMonitor(m_model->monitorId), range, rect, opacity, m_sourceFrameSize, false,
m_model->data(m_index, AssetParameterModel::OpacityRole).toBool(), integerOpacity, this);
m_model->data(m_index, AssetParameterModel::OpacityRole).toBool(), this);
connect(geomWidget, &GeometryWidget::valueChanged,
this, [this, index](const QString v) {
emit activateEffect();
......
......@@ -13,14 +13,14 @@
#include <QGridLayout>
GeometryWidget::GeometryWidget(Monitor *monitor, QPair<int, int> range, const QRect &rect, double opacity, const QSize frameSize, bool useRatioLock,
bool useOpacity, bool percentOpacity, QWidget *parent)
bool useOpacity, QWidget *parent)
: QWidget(parent)
, m_min(range.first)
, m_max(range.second)
, m_active(false)
, m_monitor(monitor)
, m_opacity(nullptr)
, m_opacityFactor(percentOpacity ? 1. : 100.)
, m_opacityFactor(100.)
{
Q_UNUSED(useRatioLock)
setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
......
......@@ -30,7 +30,7 @@ public:
* @param useRatioLock When true, width/height will keep the profile's aspect ratio on resize
*/
explicit GeometryWidget(Monitor *monitor, QPair<int, int> range, const QRect &rect, double opacity, const QSize frameSize, bool useRatioLock,
bool useOpacity, bool percentOpacity, QWidget *parent = nullptr);
bool useOpacity, QWidget *parent = nullptr);
void setValue(const QRect r, double opacity = 1);
void connectMonitor(bool activate);
......
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