base pointer movement in timeline

This commit is contained in:
itsmattkc
2019-08-21 15:10:55 +10:00
parent 78d96ecd28
commit f03cc8fe07
14 changed files with 166 additions and 62 deletions
+22 -3
View File
@@ -245,12 +245,12 @@ void TrackOutput::AddBlockToGraph(Block *block)
void TrackOutput::PlaceBlock(Block *block, rational start)
{
AddBlockToGraph(block);
if (block->in() == start) {
if (block_cache_.contains(block) && block->in() == start) {
return;
}
AddBlockToGraph(block);
// Check if the placement location is past the end of the timeline
if (start >= in()) {
if (start > in()) {
@@ -408,3 +408,22 @@ void TrackOutput::RippleRemoveArea(rational in, rational out, Block *insert)
}
}
}
void TrackOutput::ReplaceBlock(Block *old, Block *replace)
{
Block* previous = old->previous();
Block* next = old->next();
AddBlockToGraph(replace);
// Disconnect old block from its surroundings
if (previous != nullptr) {
Block::DisconnectBlocks(previous, old);
Block::ConnectBlocks(previous, replace);
}
if (next != nullptr) {
Block::DisconnectBlocks(old, next);
Block::ConnectBlocks(replace, next);
}
}