Adds a button to clone the BB track pattern
Adds a button on the BBEditor that clones the current BB track pattern, but without also cloning the song editor TCOs. That can be useful when an user is editing drumlines and wants to make a section with a slight variation for example.
This commit is contained in:
BIN
data/themes/classic/clone_bb_track_pattern.png
Normal file
BIN
data/themes/classic/clone_bb_track_pattern.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 614 B |
BIN
data/themes/default/clone_bb_track_pattern.png
Normal file
BIN
data/themes/default/clone_bb_track_pattern.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 208 B |
@@ -86,6 +86,7 @@ public slots:
|
||||
void removeSteps();
|
||||
void addSampleTrack();
|
||||
void addAutomationTrack();
|
||||
void cloneBBTrackPattern();
|
||||
|
||||
protected slots:
|
||||
void dropEvent(QDropEvent * de ) override;
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <QLayout>
|
||||
|
||||
#include "ComboBox.h"
|
||||
#include "BBTrack.h"
|
||||
#include "BBTrackContainer.h"
|
||||
#include "embed.h"
|
||||
#include "MainWindow.h"
|
||||
@@ -86,6 +87,8 @@ BBEditor::BBEditor( BBTrackContainer* tc ) :
|
||||
|
||||
trackAndStepActionsToolBar->addAction(embed::getIconPixmap("add_bb_track"), tr("Add beat/bassline"),
|
||||
Engine::getSong(), SLOT(addBBTrack()));
|
||||
trackAndStepActionsToolBar->addAction(embed::getIconPixmap("clone_bb_track_pattern"), tr("Clone beat/bassline pattern"),
|
||||
m_trackContainerView, SLOT(cloneBBTrackPattern()));
|
||||
trackAndStepActionsToolBar->addAction(
|
||||
embed::getIconPixmap("add_sample_track"),
|
||||
tr("Add sample-track"), m_trackContainerView,
|
||||
@@ -311,3 +314,21 @@ void BBTrackContainerView::makeSteps( bool clone )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Creates a clone of the current BB track with the same pattern, but with no TCOs on the song editor
|
||||
void BBTrackContainerView::cloneBBTrackPattern()
|
||||
{
|
||||
// Get the current BBTrack id
|
||||
BBTrackContainer *bbtc = static_cast<BBTrackContainer*>(model());
|
||||
const int cur_bb = bbtc->currentBB();
|
||||
|
||||
BBTrack *bbt = BBTrack::findBBTrack(cur_bb);
|
||||
|
||||
// Clone the track
|
||||
Track *newTrack = bbt->clone();
|
||||
|
||||
// Track still have the TCOs which is undesirable in this case, clear the track
|
||||
newTrack->lock();
|
||||
newTrack->deleteTCOs();
|
||||
newTrack->unlock();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user