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

Fix incorrect source frame size for transform effects.

Related to #290
parent 575506f6
Pipeline #6069 passed with stage
in 27 minutes and 27 seconds
......@@ -92,7 +92,7 @@ AbstractParamWidget *AbstractParamWidget::construct(const std::shared_ptr<AssetP
case ParamType::KeyframeParam:
case ParamType::AnimatedRect:
case ParamType::Roto_spline:
widget = new KeyframeWidget(model, index, parent);
widget = new KeyframeWidget(model, index, frameSize, parent);
break;
case ParamType::Geometry:
widget = new GeometryEditWidget(model, index, frameSize, parent);
......
......@@ -46,13 +46,13 @@
#include <klocalizedstring.h>
#include <utility>
KeyframeWidget::KeyframeWidget(std::shared_ptr<AssetParameterModel> model, QModelIndex index, QWidget *parent)
KeyframeWidget::KeyframeWidget(std::shared_ptr<AssetParameterModel> model, QModelIndex index, QSize frameSize, QWidget *parent)
: AbstractParamWidget(std::move(model), index, parent)
, m_monitorHelper(nullptr)
, m_neededScene(MonitorSceneType::MonitorSceneDefault)
, m_sourceFrameSize(frameSize.isValid() && !frameSize.isNull() ? frameSize : pCore->getCurrentFrameSize())
{
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
m_lay = new QVBoxLayout(this);
m_lay->setContentsMargins(2, 2, 2, 0);
m_lay->setSpacing(0);
......@@ -335,7 +335,6 @@ void KeyframeWidget::addParameter(const QPersistentModelIndex &index)
m_neededScene = MonitorSceneType::MonitorSceneGeometry;
int inPos = m_model->data(index, AssetParameterModel::ParentInRole).toInt();
QPair<int, int> range(inPos, inPos + m_model->data(index, AssetParameterModel::ParentDurationRole).toInt());
QSize frameSize = pCore->getCurrentFrameSize();
const QString value = m_keyframes->getInterpolatedValue(getPosition(), index).toString();
QRect rect;
double opacity = 0;
......@@ -348,7 +347,7 @@ 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, frameSize, false,
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);
connect(geomWidget, &GeometryWidget::valueChanged,
[this, index](const QString v) { m_keyframes->updateKeyframe(GenTime(getPosition(), pCore->getCurrentFps()), QVariant(v), index); });
......
......@@ -43,7 +43,7 @@ class KeyframeWidget : public AbstractParamWidget
Q_OBJECT
public:
explicit KeyframeWidget(std::shared_ptr<AssetParameterModel> model, QModelIndex index, QWidget *parent = nullptr);
explicit KeyframeWidget(std::shared_ptr<AssetParameterModel> model, QModelIndex index, QSize frameSize, QWidget *parent = nullptr);
~KeyframeWidget() override;
/* @brief Add a new parameter to be managed using the same keyframe viewer */
......@@ -94,6 +94,7 @@ private:
KSelectAction *m_selectType;
TimecodeDisplay *m_time;
MonitorSceneType m_neededScene;
QSize m_sourceFrameSize;
void connectMonitor(bool active);
std::unordered_map<QPersistentModelIndex, QWidget *> m_parameters;
......
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