Ensure color/image/title clips parent producer always has out set as the...

Ensure color/image/title clips parent producer always has out set as the longest duration of its timeline clips.
Fixes broken keyframes issue in timeline
parent b331578c
......@@ -1028,7 +1028,7 @@ void KeyframeModel::sendModification()
QString name = ptr->data(m_index, AssetParameterModel::NameRole).toString();
if (m_paramType == ParamType::KeyframeParam || m_paramType == ParamType::AnimatedRect || m_paramType == ParamType::Roto_spline) {
m_lastData = getAnimProperty();
ptr->setParameter(name, m_lastData, false);
ptr->setParameter(name, m_lastData, false, m_index);
} else {
Q_ASSERT(false); // Not implemented, TODO
}
......@@ -1047,7 +1047,7 @@ void KeyframeModel::refresh()
}
if (animData == m_lastData) {
// nothing to do
qDebug() << "// DATA WAS ALREADY PARSED, ABORTING REFRESH\n_________________";
qDebug() << "// DATA WAS ALREADY PARSED, ABORTING REFRESH\n";
return;
}
if (m_paramType == ParamType::KeyframeParam || m_paramType == ParamType::AnimatedRect) {
......
......@@ -340,6 +340,8 @@ void AssetParameterModel::internalSetParameter(const QString &name, const QStrin
KeyframeModel *km = m_keyframes->getKeyModel(paramIndex);
if (km) {
km->refresh();
} else {
qDebug()<<"====ERROR KFMODEL NOT FOUND FOR: "<<paramIndex;
}
//m_keyframes->refresh();
}
......@@ -352,7 +354,7 @@ void AssetParameterModel::internalSetParameter(const QString &name, const QStrin
void AssetParameterModel::setParameter(const QString &name, const QString &paramValue, bool update, const QModelIndex &paramIndex)
{
//qDebug() << "// PROCESSING PARAM CHANGE: " << name << ", UPDATE: " << update << ", VAL: " << paramValue;
// qDebug() << "// PROCESSING PARAM CHANGE: " << name << ", UPDATE: " << update << ", VAL: " << paramValue;
internalSetParameter(name, paramValue, paramIndex);
bool updateChildRequired = true;
if (m_assetId.startsWith(QStringLiteral("sox_"))) {
......
......@@ -3991,7 +3991,9 @@ void Bin::reloadAllProducers(bool reloadThumbs)
}
if (clip->isValid()) {
clip->resetProducerProperty(QStringLiteral("kdenlive:duration"));
clip->resetProducerProperty(QStringLiteral("length"));
if (clip->hasLimitedDuration()) {
clip->resetProducerProperty(QStringLiteral("length"));
}
}
if (!xml.isNull()) {
clip->setClipStatus(FileStatus::StatusWaiting);
......
......@@ -324,7 +324,7 @@ bool LoadJob::startJob()
}
m_producer->set("length", producerLength);
m_producer->set("kdenlive:duration", duration);
m_producer->set("out", duration - 1);
m_producer->set("out", producerLength - 1);
}
break;
case ClipType::QText:
......
......@@ -132,6 +132,14 @@ int ClipModel::construct(const std::shared_ptr<TimelineModel> &parent, const QSt
clip->setClipState_lambda(state)();
clip->setSubPlaylistIndex(playlist, -1);
parent->registerClip(clip);
if (clip->m_endlessResize) {
// Ensure parent is long enough
if (producer->parent().get_out() < producer->get_length() - 1) {
int out = producer->get_length();
producer->parent().set("length", out + 1);
producer->parent().set("out", out);
}
}
clip->m_effectStack->importEffects(producer, state, result.second, originalDecimalPoint);
clip->m_clipMarkerModel->setReferenceModel(binClip->getMarkerModel(), speed);
return id;
......@@ -215,6 +223,7 @@ bool ClipModel::requestResize(int size, bool right, Fun &undo, Fun &redo, bool l
// Ensure producer is long enough
if (m_endlessResize && outPoint > m_producer->parent().get_length()) {
m_producer->set("length", outPoint + 1);
m_producer->set("out", outPoint);
}
}
QVector<int> roles{TimelineModel::DurationRole};
......
......@@ -1732,6 +1732,7 @@ bool TimelineFunctions::pasteTimelineClips(const std::shared_ptr<TimelineItemMod
out = out - in;
in = 0;
timeline->m_allClips[newId]->m_producer->set("length", out + 1);
timeline->m_allClips[newId]->m_producer->set("out", out);
}
timeline->m_allClips[newId]->setInOut(in, out);
int targetId = prod.attribute(QStringLiteral("id")).toInt();
......
......@@ -268,19 +268,20 @@ bool TrackModel::requestClipInsertion(int clipId, int position, bool updateView,
return false;
}
if (auto ptr = m_parent.lock()) {
if (isAudioTrack() && !ptr->getClipPtr(clipId)->canBeAudio()) {
std::shared_ptr<ClipModel> clip = ptr->getClipPtr(clipId);
if (isAudioTrack() && !clip->canBeAudio()) {
qDebug() << "// ATTEMPTING TO INSERT NON AUDIO CLIP ON AUDIO TRACK";
return false;
}
if (!isAudioTrack() && !ptr->getClipPtr(clipId)->canBeVideo()) {
if (!isAudioTrack() && !clip->canBeVideo()) {
qDebug() << "// ATTEMPTING TO INSERT NON VIDEO CLIP ON VIDEO TRACK";
return false;
}
Fun local_undo = []() { return true; };
Fun local_redo = []() { return true; };
bool res = true;
if (ptr->getClipPtr(clipId)->clipState() != PlaylistState::Disabled) {
res = ptr->getClipPtr(clipId)->setClipState(isAudioTrack() ? PlaylistState::AudioOnly : PlaylistState::VideoOnly, local_undo, local_redo);
if (clip->clipState() != PlaylistState::Disabled) {
res = clip->setClipState(isAudioTrack() ? PlaylistState::AudioOnly : PlaylistState::VideoOnly, local_undo, local_redo);
}
int duration = trackDuration();
auto operation = requestClipInsertion_lambda(clipId, position, updateView, finalMove, groupMove);
......
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