timeline: fixed double remove on transitions

Fixes #1655
This commit is contained in:
itsmattkc
2021-07-22 01:09:06 -07:00
parent 7dfb234b2f
commit 7fe8dbc77a
5 changed files with 10 additions and 6 deletions
+3 -2
View File
@@ -447,7 +447,8 @@ void TimelineWidget::SplitAtPlayhead()
void TimelineWidget::ReplaceBlocksWithGaps(const QVector<Block *> &blocks,
bool remove_from_graph,
MultiUndoCommand *command)
MultiUndoCommand *command,
bool handle_transitions)
{
foreach (Block* b, blocks) {
if (dynamic_cast<GapBlock*>(b)) {
@@ -458,7 +459,7 @@ void TimelineWidget::ReplaceBlocksWithGaps(const QVector<Block *> &blocks,
Track* original_track = b->track();
command->add_child(new TrackReplaceBlockWithGapCommand(original_track, b));
command->add_child(new TrackReplaceBlockWithGapCommand(original_track, b, handle_transitions));
if (remove_from_graph) {
command->add_child(new NodeRemoveWithExclusiveDependenciesAndDisconnect(b));
+1 -1
View File
@@ -112,7 +112,7 @@ public:
void RestoreSplitterState(const QByteArray& state);
static void ReplaceBlocksWithGaps(const QVector<Block *> &blocks, bool remove_from_graph, MultiUndoCommand *command);
static void ReplaceBlocksWithGaps(const QVector<Block *> &blocks, bool remove_from_graph, MultiUndoCommand *command, bool handle_transitions = true);
/**
* @brief Retrieve the QGraphicsItem at a particular scene position
+1 -1
View File
@@ -591,7 +591,7 @@ void PointerTool::FinishDrag(TimelineViewMouseEvent *event)
blocks_to_delete[i] = blocks_moving.at(i).block;
}
parent()->ReplaceBlocksWithGaps(blocks_to_delete, false, command);
parent()->ReplaceBlocksWithGaps(blocks_to_delete, false, command, false);
}
if (inserting) {
@@ -441,7 +441,7 @@ void TrackListInsertGaps::undo()
void TrackReplaceBlockWithGapCommand::redo()
{
// Determine if this block is connected to any transitions that should also be removed by this operation
if (transition_remove_commands_.isEmpty()) {
if (handle_transitions_ && transition_remove_commands_.isEmpty()) {
CreateRemoveTransitionCommandIfNecessary(false);
CreateRemoveTransitionCommandIfNecessary(true);
}
@@ -196,12 +196,13 @@ private:
class TrackReplaceBlockWithGapCommand : public UndoCommand {
public:
TrackReplaceBlockWithGapCommand(Track* track, Block* block) :
TrackReplaceBlockWithGapCommand(Track* track, Block* block, bool handle_transitions = true) :
track_(track),
block_(block),
existing_gap_(nullptr),
existing_merged_gap_(nullptr),
our_gap_(nullptr),
handle_transitions_(handle_transitions),
position_command_(nullptr)
{
}
@@ -232,6 +233,8 @@ private:
bool existing_gap_precedes_;
GapBlock* our_gap_;
bool handle_transitions_;
NodeSetPositionAsChildCommand* position_command_;
QObject memory_manager_;