Skip to content

Commit 43b700d

Browse files
committed
Ensure correct TCOs after cloning tracks into the BB editor
Previously BBTrackContainerView::dropEvent always deleted the TCOs of dropped tracks. It made dropped tracks unusable. As of this commit, the function checks for correct TCOs. If incorrect TCOs exist, the function remove them and add empty ones.
1 parent 5a92105 commit 43b700d

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

src/gui/editors/BBEditor.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,25 @@ void BBTrackContainerView::dropEvent(QDropEvent* de)
258258
DataFile dataFile( value.toUtf8() );
259259
Track * t = Track::create( dataFile.content().firstChild().toElement(), model() );
260260

261-
t->deleteTCOs();
261+
// Ensure BB TCOs exist
262+
bool hasValidBBTCOs = false;
263+
if (t->getTCOs().size() == m_bbtc->numOfBBs())
264+
{
265+
hasValidBBTCOs = true;
266+
for (int i = 0; i < t->getTCOs().size(); ++i)
267+
{
268+
if (t->getTCOs()[i]->startPosition() != MidiTime(i, 0))
269+
{
270+
hasValidBBTCOs = false;
271+
break;
272+
}
273+
}
274+
}
275+
if (!hasValidBBTCOs)
276+
{
277+
t->deleteTCOs();
278+
t->createTCOsForBB(m_bbtc->numOfBBs() - 1);
279+
}
262280
m_bbtc->updateAfterTrackAdd();
263281

264282
de->accept();

0 commit comments

Comments
 (0)