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

Fix compositions disappear after reopening project with locked track.

BUG: 412369
parent 32d8c095
Pipeline #9647 failed with stage
in 3 minutes and 4 seconds
...@@ -62,6 +62,7 @@ bool constructTimelineFromMelt(const std::shared_ptr<TimelineItemModel> &timelin ...@@ -62,6 +62,7 @@ bool constructTimelineFromMelt(const std::shared_ptr<TimelineItemModel> &timelin
bool ok = true; bool ok = true;
qDebug() << "//////////////////////\nTrying to construct" << tractor.count() << "tracks.\n////////////////////////////////"; qDebug() << "//////////////////////\nTrying to construct" << tractor.count() << "tracks.\n////////////////////////////////";
QList <int> videoTracksIndexes; QList <int> videoTracksIndexes;
QList <int> lockedTracksIndexes;
// Black track index // Black track index
videoTracksIndexes << 0; videoTracksIndexes << 0;
for (int i = 0; i < tractor.count() && ok; i++) { for (int i = 0; i < tractor.count() && ok; i++) {
...@@ -83,14 +84,13 @@ bool constructTimelineFromMelt(const std::shared_ptr<TimelineItemModel> &timelin ...@@ -83,14 +84,13 @@ bool constructTimelineFromMelt(const std::shared_ptr<TimelineItemModel> &timelin
videoTracksIndexes << i; videoTracksIndexes << i;
} }
ok = timeline->requestTrackInsertion(-1, tid, QString(), audioTrack, undo, redo, false); ok = timeline->requestTrackInsertion(-1, tid, QString(), audioTrack, undo, redo, false);
int lockState = track->get_int("kdenlive:locked_track"); if (track->get_int("kdenlive:locked_track") > 0) {
lockedTracksIndexes << tid;
}
Mlt::Tractor local_tractor(*track); Mlt::Tractor local_tractor(*track);
ok = ok && constructTrackFromMelt(timeline, tid, local_tractor, binIdCorresp, undo, redo, audioTrack, progressDialog); ok = ok && constructTrackFromMelt(timeline, tid, local_tractor, binIdCorresp, undo, redo, audioTrack, progressDialog);
timeline->setTrackProperty(tid, QStringLiteral("kdenlive:thumbs_format"), track->get("kdenlive:thumbs_format")); timeline->setTrackProperty(tid, QStringLiteral("kdenlive:thumbs_format"), track->get("kdenlive:thumbs_format"));
timeline->setTrackProperty(tid, QStringLiteral("kdenlive:audio_rec"), track->get("kdenlive:audio_rec")); timeline->setTrackProperty(tid, QStringLiteral("kdenlive:audio_rec"), track->get("kdenlive:audio_rec"));
if (lockState > 0) {
timeline->setTrackLockedState(tid, true);
}
break; break;
} }
case playlist_type: { case playlist_type: {
...@@ -108,13 +108,13 @@ bool constructTimelineFromMelt(const std::shared_ptr<TimelineItemModel> &timelin ...@@ -108,13 +108,13 @@ bool constructTimelineFromMelt(const std::shared_ptr<TimelineItemModel> &timelin
if (muteState > 0 && (!audioTrack || (audioTrack && muteState != 1))) { if (muteState > 0 && (!audioTrack || (audioTrack && muteState != 1))) {
timeline->setTrackProperty(tid, QStringLiteral("hide"), QString::number(muteState)); timeline->setTrackProperty(tid, QStringLiteral("hide"), QString::number(muteState));
} }
int lockState = local_playlist.get_int("kdenlive:locked_track");
ok = ok && constructTrackFromMelt(timeline, tid, local_playlist, binIdCorresp, undo, redo, audioTrack, progressDialog); ok = ok && constructTrackFromMelt(timeline, tid, local_playlist, binIdCorresp, undo, redo, audioTrack, progressDialog);
if (local_playlist.get_int("kdenlive:locked_track") > 0) {
lockedTracksIndexes << tid;
}
timeline->setTrackProperty(tid, QStringLiteral("kdenlive:thumbs_format"), local_playlist.get("kdenlive:thumbs_format")); timeline->setTrackProperty(tid, QStringLiteral("kdenlive:thumbs_format"), local_playlist.get("kdenlive:thumbs_format"));
timeline->setTrackProperty(tid, QStringLiteral("kdenlive:audio_rec"), track->get("kdenlive:audio_rec")); timeline->setTrackProperty(tid, QStringLiteral("kdenlive:audio_rec"), track->get("kdenlive:audio_rec"));
if (lockState > 0) {
timeline->setTrackLockedState(tid, true);
}
break; break;
} }
default: default:
...@@ -176,7 +176,11 @@ bool constructTimelineFromMelt(const std::shared_ptr<TimelineItemModel> &timelin ...@@ -176,7 +176,11 @@ bool constructTimelineFromMelt(const std::shared_ptr<TimelineItemModel> &timelin
// build internal track compositing // build internal track compositing
timeline->buildTrackCompositing(); timeline->buildTrackCompositing();
//timeline->updateDuration();
// load locked state as last step
for (int tid : lockedTracksIndexes) {
timeline->setTrackLockedState(tid, true);
}
if (!ok) { if (!ok) {
// TODO log error // TODO log error
......
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