Fix crash trying to import keyframes in rotoscoping effect

Related to #615
parent 1e2584e5
......@@ -46,8 +46,7 @@
#include "mlt++/MltProperties.h"
KeyframeImport::KeyframeImport(const QString &animData, std::shared_ptr<AssetParameterModel> model, QList<QPersistentModelIndex> indexes,
QWidget *parent)
KeyframeImport::KeyframeImport(const QString &animData, std::shared_ptr<AssetParameterModel> model, QList<QPersistentModelIndex> indexes, int parentIn, int parentDuration, QWidget *parent)
: QDialog(parent)
, m_model(std::move(model))
, m_indexes(indexes)
......@@ -141,7 +140,7 @@ KeyframeImport::KeyframeImport(const QString &animData, std::shared_ptr<AssetPar
// Zone in / out
in = qMax(0, in);
if (out <= 0) {
out = in + m_model->data(indexes.first(), AssetParameterModel::ParentDurationRole).toInt();
out = in + parentDuration;
}
m_inPoint = new PositionWidget(i18n("In"), in, 0, out, pCore->currentDoc()->timecode(), QString(), this);
connect(m_inPoint, &PositionWidget::valueChanged, this, &KeyframeImport::updateDisplay);
......@@ -219,8 +218,8 @@ KeyframeImport::KeyframeImport(const QString &animData, std::shared_ptr<AssetPar
lay->addLayout(l1);
// Output offset
int clipIn = m_model->data(indexes.first(), AssetParameterModel::ParentInRole).toInt();
m_offsetPoint = new PositionWidget(i18n("Offset"), clipIn, 0, clipIn + m_model->data(indexes.first(), AssetParameterModel::ParentDurationRole).toInt(), pCore->currentDoc()->timecode(), "", this);
int clipIn = parentIn;
m_offsetPoint = new PositionWidget(i18n("Offset"), clipIn, 0, clipIn + parentDuration, pCore->currentDoc()->timecode(), "", this);
lay->addWidget(m_offsetPoint);
// Source range
......
......@@ -42,8 +42,7 @@ class KeyframeImport : public QDialog
{
Q_OBJECT
public:
explicit KeyframeImport(const QString &animData, std::shared_ptr<AssetParameterModel> model, QList<QPersistentModelIndex> indexes,
QWidget *parent = nullptr);
explicit KeyframeImport(const QString &animData, std::shared_ptr<AssetParameterModel> model, QList<QPersistentModelIndex> indexes, int parentIn, int parentDuration, QWidget *parent = nullptr);
~KeyframeImport() override;
QString selectedData() const;
void importSelectedData();
......
......@@ -491,7 +491,7 @@ void KeyframeWidget::slotImportKeyframes()
for (const auto &w : m_parameters) {
indexes << w.first;
}
QPointer<KeyframeImport> import = new KeyframeImport(values, m_model, indexes, this);
QPointer<KeyframeImport> import = new KeyframeImport(values, m_model, indexes, m_model->data(m_index, AssetParameterModel::ParentInRole).toInt(), m_model->data(m_index, AssetParameterModel::ParentDurationRole).toInt(), this);
if (import->exec() != QDialog::Accepted) {
delete import;
return;
......
......@@ -335,7 +335,7 @@ Item {
Text {
id: label
text: i18n("Click to add points,\nright click to close shape.")
font: miniFont
font: fixedFont
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
anchors {
......
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