Skip to content

Commit

Permalink
Preserve priority of global automation clips
Browse files Browse the repository at this point in the history
  • Loading branch information
PhysSong committed Sep 11, 2024
1 parent 0451c38 commit 0b9db06
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/core/DataFile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1651,6 +1651,7 @@ void DataFile::upgrade_noHiddenAutomationTracks()
{
// global automationclips
QDomNodeList aps = gaTrack.elementsByTagName("automationclip");
QList<QDomNode> tracksToInsert;
for (int i = 0; i < aps.length(); ++i)
{
QDomElement ap = aps.item(i).toElement();
Expand All @@ -1669,9 +1670,15 @@ void DataFile::upgrade_noHiddenAutomationTracks()
QDomElement at = createElement("automationtrack");
aptrack.appendChild(at);
aptrack.appendChild(aps.item(i).cloneNode());
tc.appendChild(aptrack);
tracksToInsert.prepend(aptrack); // To preserve orders
}
}

// Insert the tracks at the beginning of tc, preserving their order
for (const auto& track : tracksToInsert) {
tc.insertBefore(track, tc.firstChild());
}

// Remove the track object just in case
gaTrack.parentNode().removeChild(gaTrack);
}
Expand Down

0 comments on commit 0b9db06

Please sign in to comment.