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

Fix track effect keyframes

Fixes #238
parent 37f2d6a6
Pipeline #6322 passed with stage
in 17 minutes and 24 seconds
......@@ -379,6 +379,7 @@ int Core::getItemPosition(const ObjectId &id)
}
break;
case ObjectType::BinClip:
case ObjectType::TimelineTrack:
return 0;
break;
default:
......@@ -402,9 +403,8 @@ int Core::getItemIn(const ObjectId &id)
}
break;
case ObjectType::TimelineComposition:
return 0;
break;
case ObjectType::BinClip:
case ObjectType::TimelineTrack:
return 0;
break;
default:
......@@ -454,6 +454,8 @@ int Core::getItemDuration(const ObjectId &id)
case ObjectType::BinClip:
return (int)m_binWidget->getClipDuration(id.second);
break;
case ObjectType::TimelineTrack:
return m_mainWindow->getCurrentTimeline()->controller()->duration();
default:
qDebug() << "ERROR: unhandled object type";
}
......
......@@ -442,6 +442,7 @@ bool EffectStackModel::appendEffect(const QString &effectId, bool makeCurrent)
if (res) {
int inFades = 0;
int outFades = 0;
if (effectId == QLatin1String("fadein") || effectId == QLatin1String("fade_from_black")) {
int duration = effect->filter().get_length() - 1;
int in = pCore->getItemIn(m_ownerId);
......@@ -454,6 +455,8 @@ bool EffectStackModel::appendEffect(const QString &effectId, bool makeCurrent)
effect->filter().set("in", out - duration);
effect->filter().set("out", out);*/
outFades++;
} else if (m_ownerId.first == ObjectType::TimelineTrack) {
effect->filter().set("out", pCore->getItemDuration(m_ownerId));
}
QString effectName = EffectsRepository::get()->getName(effectId);
Fun update = [this, inFades, outFades]() {
......@@ -1155,6 +1158,9 @@ bool EffectStackModel::addEffectKeyFrame(int frame, double normalisedVal)
}
std::shared_ptr<EffectItemModel> sourceEffect = std::static_pointer_cast<EffectItemModel>(rootItem->child(ix));
std::shared_ptr<KeyframeModelList> listModel = sourceEffect->getKeyframeModel();
if (m_ownerId.first == ObjectType::TimelineTrack) {
sourceEffect->filter().set("out", pCore->getItemDuration(m_ownerId));
}
return listModel->addKeyframe(frame, normalisedVal);
}
......@@ -1185,5 +1191,8 @@ bool EffectStackModel::updateKeyFrame(int oldFrame, int newFrame, QVariant norma
}
std::shared_ptr<EffectItemModel> sourceEffect = std::static_pointer_cast<EffectItemModel>(rootItem->child(ix));
std::shared_ptr<KeyframeModelList> listModel = sourceEffect->getKeyframeModel();
if (m_ownerId.first == ObjectType::TimelineTrack) {
sourceEffect->filter().set("out", pCore->getItemDuration(m_ownerId));
}
return listModel->updateKeyframe(GenTime(oldFrame, pCore->getCurrentFps()), GenTime(newFrame, pCore->getCurrentFps()), std::move(normalisedVal));
}
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