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

Merge branch '2112'

parents 0bcfe335 88146032
Pipeline #103968 passed with stage
in 8 minutes and 50 seconds
......@@ -3,7 +3,7 @@
<name>Motion Tracker</name>
<description>Select a zone to follow its movements</description>
<author>Jean-Baptiste Mardelle</author>
<parameter type="animatedrect" name="results" opacity="false" conditional="1" default="50% 50% 25% 25%">
<parameter type="animatedrect" name="results" opacity="false" conditional="1" opacity="false" default="50% 50% 25% 25%">
<name>Rectangle</name>
</parameter>
<parameter type="listdependency" name="algo" default="KCF" paramlist="KCF;CSRT;MOSSE;MIL;MEDIANFLOW;DaSIAM" conditional="1">
......
data/pics/splash-background.png

456 KB | W: | H:

data/pics/splash-background.png

317 KB | W: | H:

data/pics/splash-background.png
data/pics/splash-background.png
data/pics/splash-background.png
data/pics/splash-background.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -920,6 +920,7 @@ QJsonDocument AssetParameterModel::toJson(bool includeFixed) const
double factor = data(ix, AssetParameterModel::FactorRole).toDouble();
int in = data(ix, AssetParameterModel::ParentInRole).toInt();
int out = in + data(ix, AssetParameterModel::ParentDurationRole).toInt();
bool opacity = data(ix, AssetParameterModel::OpacityRole).toBool();
if (factor > 0) {
min /= factor;
max /= factor;
......@@ -929,6 +930,7 @@ QJsonDocument AssetParameterModel::toJson(bool includeFixed) const
currentParam.insert(QLatin1String("max"), QJsonValue(max));
currentParam.insert(QLatin1String("in"), QJsonValue(in));
currentParam.insert(QLatin1String("out"), QJsonValue(out));
currentParam.insert(QLatin1String("opacity"), QJsonValue(opacity));
list.push_back(currentParam);
}
if(!(x.isEmpty() || y.isEmpty() || w.isEmpty() || h.isEmpty())) {
......
......@@ -37,6 +37,8 @@ KeyframeImport::KeyframeImport(const QString &animData, std::shared_ptr<AssetPar
, m_indexes(indexes)
, m_supportsAnim(false)
, m_previewLabel(nullptr)
, m_sourceCombo(nullptr)
, m_targetCombo(nullptr)
, m_isReady(false)
{
setAttribute(Qt::WA_DeleteOnClose);
......@@ -115,11 +117,13 @@ KeyframeImport::KeyframeImport(const QString &animData, std::shared_ptr<AssetPar
if (out == -1) {
out = entryObj[QLatin1String("out")].toInt(0);
}
bool opacity = entryObj[QLatin1String("opacity")].toBool(true);
m_dataCombo->insertItem(ix, displayName);
m_dataCombo->setItemData(ix, value, Qt::UserRole);
m_dataCombo->setItemData(ix, type, Qt::UserRole + 1);
m_dataCombo->setItemData(ix, min, Qt::UserRole + 2);
m_dataCombo->setItemData(ix, max, Qt::UserRole + 3);
m_dataCombo->setItemData(ix, opacity, Qt::UserRole + 4);
ix++;
}
m_previewLabel = new QLabel(this);
......@@ -646,15 +650,14 @@ QString KeyframeImport::selectedData() const
keyPos = anim2->next_key(keyPos);
}
anim2->interpolate();
int length = lastKeyframe;
int length = lastKeyframe - firstKeyframe;
double interval = double(length) / (m_limitNumber->value() - 1);
int pos = 0;
for (int i = 0; i < m_limitNumber->value(); i++) {
pos = firstKeyframe + in + i * interval;
pos = qMin(pos, length - 1);
pos = firstKeyframe + i * interval;
pos = qMin(pos, lastKeyframe);
mlt_rect rect = animData->anim_get_rect("key", pos);
animData2->anim_set("key", rect, pos);
}
anim2->interpolate();
return anim2->serialize_cut();
......@@ -826,7 +829,7 @@ void KeyframeImport::importSelectedData()
// wether we are mapping to a fake rectangle
bool fakeRect = m_targetCombo->currentData().isNull() && m_targetCombo->currentText() == i18n("Rectangle");
bool useOpacity = m_dataCombo->currentData(Qt::UserRole + 4).toBool();
if (ix == m_targetCombo->currentData().toModelIndex() || fakeRect) {
// Import our keyframes
int frame = 0;
......@@ -883,6 +886,9 @@ void KeyframeImport::importSelectedData()
break;
}
mlt_rect rect = animData->anim_get_rect("key", frame);
if (!useOpacity) {
rect.o = 1;
}
if (convertMode == ImportRoles::Position || convertMode == ImportRoles::InvertedPosition) {
switch (sourceAlign) {
case 1:
......@@ -975,7 +981,9 @@ void KeyframeImport::importSelectedData()
kfrData[1] = locale.toString(int(rect.y));
kfrData[2] = locale.toString(int(rect.w));
kfrData[3] = locale.toString(int(rect.h));
kfrData[4] = QString::number(rect.o);
if (size > 4) {
kfrData[4] = QString::number(rect.o);
}
break;
case ImportRoles::Position:
kfrData[0] = locale.toString(int(rect.x));
......@@ -1285,6 +1293,11 @@ void KeyframeImport::updateView()
void KeyframeImport::reject()
{
if (m_targetCombo == nullptr) {
// no data to import, close
QDialog::reject();
return;
}
for (int i = 0; i < m_targetCombo->count(); i++) {
QPersistentModelIndex ix = m_targetCombo->itemData(i).toModelIndex();
if (m_originalParams.contains(ix)) {
......
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