moved timeline undoable commands to using the new NodeAddCommand

Previous iteration used some "magic code" that added clips automatically to the
timeline. This was functional but ultimately outside of the undo commands'
control meaning nodes could be infinitely added and abandoned. This makes the
add process part of the undo command which means it's all undoable as the user
would expect.
This commit is contained in:
itsmattkc
2019-12-14 00:04:57 +11:00
parent 18bf126574
commit 323718bc11
21 changed files with 120 additions and 114 deletions
+5 -22
View File
@@ -231,17 +231,19 @@ void TrackOutput::PrependBlock(Block *block)
void TrackOutput::InsertBlockAtIndex(Block *block, int index)
{
AddBlockToGraph(block);
BlockInvalidateCache();
block_input_->InsertAt(index);
NodeParam::ConnectEdge(block->output(),
block_input_->At(index));
UnblockInvalidateCache();
InvalidateCache(block->in(), track_length());
}
void TrackOutput::AppendBlock(Block *block)
{
AddBlockToGraph(block);
BlockInvalidateCache();
int last_index = block_input_->GetSize();
@@ -255,13 +257,6 @@ void TrackOutput::AppendBlock(Block *block)
InvalidateCache(block->in(), track_length());
}
void TrackOutput::AddBlockToGraph(Block *block)
{
// Find the parent graph
NodeGraph* graph = static_cast<NodeGraph*>(parent());
graph->AddNodeWithDependencies(block);
}
void TrackOutput::BlockInvalidateCache()
{
block_invalidate_cache_stack_++;
@@ -272,14 +267,6 @@ void TrackOutput::UnblockInvalidateCache()
block_invalidate_cache_stack_--;
}
void TrackOutput::RemoveBlock(Block *block)
{
GapBlock* gap = new GapBlock();
gap->set_length(block->length());
ReplaceBlock(block, gap);
}
void TrackOutput::RippleRemoveBlock(Block *block)
{
BlockInvalidateCache();
@@ -293,8 +280,6 @@ void TrackOutput::RippleRemoveBlock(Block *block)
UnblockInvalidateCache();
InvalidateCache(remove_in, track_length());
// FIXME: Should there be removing the Blocks from the graph?
}
void TrackOutput::ReplaceBlock(Block *old, Block *replace)
@@ -303,8 +288,6 @@ void TrackOutput::ReplaceBlock(Block *old, Block *replace)
BlockInvalidateCache();
AddBlockToGraph(replace);
int index_of_old_block = block_cache_.indexOf(old);
NodeParam::DisconnectEdge(old->output(),