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

Fix some corruption in same track composition

parent 604b8507
......@@ -615,15 +615,13 @@ bool TimelineModel::requestClipMove(int clipId, int trackId, int position, bool
std::pair<int, int> mixData = getTrackById_const(old_trackId)->getMixInfo(clipId);
int offset = position - mixData.first;
qDebug()<<"==== MIX UPDATED: "<<mixData.second<<", OFFSET: "<<offset;
if (finalMove && (old_trackId != trackId || position >= mixData.first + mixData.second)) {;
if (old_trackId != trackId || position >= mixData.first + mixData.second) {;
// Clip moved to another track, or outside of mix duration, delete mix
move_mix = [this, old_trackId, clipId]() {
qDebug()<<"======\nRESETTING SUB PLAYLIST\n====";
m_allClips[clipId]->setSubPlaylistIndex(0);
return getTrackById_const(old_trackId)->deleteMix(clipId);
};
restore_mix = [this, old_trackId, clipId, mixData]() {
m_allClips[clipId]->setSubPlaylistIndex(1);
return getTrackById_const(old_trackId)->createMix(clipId, mixData);
};
qDebug()<<"========\n\n\nDELETED MIX\n\n================";
......
......@@ -136,6 +136,9 @@ Fun TrackModel::requestClipInsertion_lambda(int clipId, int position, bool updat
if (auto ptr = m_parent.lock()) {
Q_ASSERT(ptr->getClipPtr(clipId)->getCurrentTrackId() == -1);
target_playlist = ptr->getClipPtr(clipId)->getSubPlaylistIndex();
if (target_playlist == 1 && ptr->getClipPtr(clipId)->getMixDuration() == 0) {
target_playlist = 0;
}
qDebug()<<"==== GOT TRARGET PLAYLIST: "<<target_playlist;
} else {
qDebug() << "impossible to get parent timeline";
......@@ -1371,6 +1374,7 @@ bool TrackModel::requestClipMix(int clipId, int position, bool updateView, bool
std::shared_ptr<ClipModel> movedClip(ptr->getClipPtr(clipId));
source_track = movedClip->getSubPlaylistIndex();
clipInitialPos = movedClip->getPosition();
movedClip->setMixDuration(mixInfo.mixDuration);
mixInfo.mixDuration = clipInitialPos - position;
mixInfo.mixPosition = position;
} else {
......
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