timeline: remove blocks from timeline if a place command has overwritten them
This commit is contained in:
@@ -23,6 +23,7 @@
|
|||||||
#include "core.h"
|
#include "core.h"
|
||||||
#include "node/graph.h"
|
#include "node/graph.h"
|
||||||
#include "node/block/transition/transition.h"
|
#include "node/block/transition/transition.h"
|
||||||
|
#include "widget/nodeview/nodeviewundo.h"
|
||||||
|
|
||||||
Node* TakeNodeFromParentGraph(Node* n, QObject* new_parent = nullptr)
|
Node* TakeNodeFromParentGraph(Node* n, QObject* new_parent = nullptr)
|
||||||
{
|
{
|
||||||
@@ -209,7 +210,9 @@ void TrackRippleRemoveAreaCommand::redo_internal()
|
|||||||
foreach (Block* remove_block, removed_blocks_) {
|
foreach (Block* remove_block, removed_blocks_) {
|
||||||
track_->RippleRemoveBlock(remove_block);
|
track_->RippleRemoveBlock(remove_block);
|
||||||
|
|
||||||
// FIXME: Delete blocks from graph and restore them in undo
|
NodeRemoveWithExclusiveDeps* command = new NodeRemoveWithExclusiveDeps(static_cast<NodeGraph*>(remove_block->parent()), remove_block);
|
||||||
|
command->redo();
|
||||||
|
remove_block_commands_.append(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we picked up a block to trim the out point of
|
// If we picked up a block to trim the out point of
|
||||||
@@ -261,12 +264,21 @@ void TrackRippleRemoveAreaCommand::undo_internal()
|
|||||||
trim_out_->set_length_and_media_out(trim_out_old_length_);
|
trim_out_->set_length_and_media_out(trim_out_old_length_);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove all blocks that are flagged for removal
|
// Restore blocks that were removed
|
||||||
foreach (Block* remove_block, removed_blocks_) {
|
for (int i=remove_block_commands_.size()-1;i>=0;i--) {
|
||||||
if (trim_in_ == nullptr) {
|
UndoCommand* command = remove_block_commands_.at(i);
|
||||||
track_->AppendBlock(remove_block);
|
command->undo();
|
||||||
} else {
|
delete command;
|
||||||
|
}
|
||||||
|
remove_block_commands_.clear();
|
||||||
|
|
||||||
|
for (int i=removed_blocks_.size();i>=0;i--) {
|
||||||
|
Block* remove_block = removed_blocks_.at(i);
|
||||||
|
|
||||||
|
if (trim_in_) {
|
||||||
track_->InsertBlockBefore(remove_block, trim_in_);
|
track_->InsertBlockBefore(remove_block, trim_in_);
|
||||||
|
} else {
|
||||||
|
track_->AppendBlock(remove_block);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
removed_blocks_.clear();
|
removed_blocks_.clear();
|
||||||
|
|||||||
@@ -169,6 +169,9 @@ protected:
|
|||||||
Block* insert_;
|
Block* insert_;
|
||||||
|
|
||||||
QObject memory_manager_;
|
QObject memory_manager_;
|
||||||
|
|
||||||
|
QList<UndoCommand*> remove_block_commands_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user