Fix list parameter default value broken (rotoscoping), ensure we always have a keyframe at in point

parent 72792d49
Pipeline #3544 passed with stage
in 14 minutes and 59 seconds
......@@ -82,7 +82,7 @@ AssetParameterModel::AssetParameterModel(std::unique_ptr<Mlt::Properties> asset,
ParamRow currentRow;
currentRow.type = paramTypeFromStr(type);
currentRow.xml = currentParameter;
if (value.isNull()) {
if (value.isEmpty()) {
QVariant defaultValue = parseAttribute(m_ownerId, QStringLiteral("default"), currentParameter);
value = defaultValue.type() == QVariant::Double ? locale.toString(defaultValue.toDouble()) : defaultValue.toString();
}
......@@ -538,7 +538,7 @@ QVariant AssetParameterModel::parseAttribute(const ObjectId &owner, const QStrin
if (ok) {
return res;
}
return defaultValue;
return defaultValue.isNull() ? content : defaultValue;
} else if (type == ParamType::Bezier_spline) {
QLocale locale;
if (locale.decimalPoint() != QLocale::c().decimalPoint()) {
......
......@@ -425,11 +425,13 @@ void KeyframeWidget::connectMonitor(bool active)
void KeyframeWidget::slotUpdateKeyframesFromMonitor(const QPersistentModelIndex &index, const QVariant &res)
{
GenTime pos(getPosition(), pCore->getCurrentFps());
if (m_keyframes->isEmpty()) {
// Always ensure first keyframe is at clip start
GenTime pos(pCore->getItemIn(m_model->getOwnerId()), pCore->getCurrentFps());
m_keyframes->addKeyframe(pos, KeyframeType::Linear);
m_keyframes->updateKeyframe(pos, res, index);
} else if (m_keyframes->hasKeyframe(getPosition()) || m_keyframes->singleKeyframe()) {
GenTime pos(getPosition(), pCore->getCurrentFps());
m_keyframes->updateKeyframe(pos, res, index);
}
}
......
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