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

Fix wipe and slide transition incorrect behavior on resize, and incorrectly...

Fix wipe and slide transition incorrect behavior on resize, and incorrectly detecting "reverse" state
parent b3552c98
......@@ -59,5 +59,25 @@ void SwitchParamWidget::slotShowComment(bool show)
void SwitchParamWidget::slotRefresh()
{
const QSignalBlocker bk(m_checkBox);
m_checkBox->setChecked(m_model->data(m_index, AssetParameterModel::ValueRole) == m_model->data(m_index, AssetParameterModel::MaxRole));
QString max = m_model->data(m_index, AssetParameterModel::MaxRole).toString();
QString val = m_model->data(m_index, AssetParameterModel::ValueRole).toString();
if (val == max) {
m_checkBox->setChecked(true);
} else {
QString min = m_model->data(m_index, AssetParameterModel::MinRole).toString();
if (val == min) {
m_checkBox->setChecked(false);
return;
}
if (val.contains(QLatin1Char(';'))) {
// Value is not equal to min/max, might be caused by a frame > timecode replacement
max = max.section(QLatin1Char(';'), 0, 0);
val = val.section(QLatin1Char(';'), 0, 0);
if (val.endsWith(max.section(QLatin1Char(' '), -1))) {
m_checkBox->setChecked(true);
} else {
m_checkBox->setChecked(false);
}
}
}
}
......@@ -166,6 +166,36 @@ bool CompositionModel::requestResize(int size, bool right, Fun &undo, Fun &redo,
};
refresh();
UPDATE_UNDO_REDO(refresh, refresh, undo, redo);
} else {
if (m_assetId == QLatin1String("slide")) {
// Slide composition uses a keyframe at end of composition, so update last keyframe
Fun refresh = [this]() {
QString animation(m_asset->get("rect"));
if (animation.contains(QLatin1Char(';'))) {
QString result = animation.section(QLatin1Char(';'), 0, 0);
result.append(QStringLiteral(";-1="));
result.append(animation.section(QLatin1Char('='), -1));
m_asset->set("rect", result.toUtf8().constData());
}
return true;
};
refresh();
UPDATE_UNDO_REDO(refresh, refresh, undo, redo);
} else if (m_assetId == QLatin1String("wipe")) {
// Slide composition uses a keyframe at end of composition, so update last keyframe
Fun refresh = [this]() {
QString animation(m_asset->get("geometry"));
if (animation.contains(QLatin1Char(';'))) {
QString result = animation.section(QLatin1Char(';'), 0, 0);
result.append(QStringLiteral(";-1="));
result.append(animation.section(QLatin1Char('='), -1));
m_asset->set("geometry", result.toUtf8().constData());
}
return true;
};
refresh();
UPDATE_UNDO_REDO(refresh, refresh, undo, redo);
}
}
}
UPDATE_UNDO_REDO(operation, reverse, undo, redo);
......
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