timeline: when ripple removing an area, don't split gaps
This commit is contained in:
@@ -210,30 +210,39 @@ void TrackRippleRemoveAreaCommand::redo_internal()
|
||||
// If we picked up a block to splice
|
||||
if (splice_) {
|
||||
|
||||
// Split the block here
|
||||
splice_split_command_ = new QUndoCommand();
|
||||
if (trim_out_->type() == Block::kGap) {
|
||||
|
||||
// Gaps shouldn't be split, just trim the difference
|
||||
trim_out_->set_length_and_media_out(trim_out_->length() - (out_ - in_));
|
||||
|
||||
if (Config::Current()[QStringLiteral("SplitClipsCopyNodes")].toBool()) {
|
||||
QVector<Node*> nodes_to_clone;
|
||||
nodes_to_clone.append(trim_out_);
|
||||
nodes_to_clone.append(trim_out_->GetDependencies());
|
||||
QVector<Node*> duplicated = Node::CopyDependencyGraph(nodes_to_clone, splice_split_command_);
|
||||
trim_in_ = static_cast<Block*>(duplicated.first());
|
||||
} else {
|
||||
trim_in_ = static_cast<Block*>(trim_out_->copy());
|
||||
new NodeAddCommand(static_cast<NodeGraph*>(track_->parent()), trim_in_, splice_split_command_);
|
||||
new NodeCopyInputsCommand(trim_out_, trim_in_, true, splice_split_command_);
|
||||
|
||||
// Split the block here
|
||||
splice_split_command_ = new QUndoCommand();
|
||||
|
||||
if (Config::Current()[QStringLiteral("SplitClipsCopyNodes")].toBool()) {
|
||||
QVector<Node*> nodes_to_clone;
|
||||
nodes_to_clone.append(trim_out_);
|
||||
nodes_to_clone.append(trim_out_->GetDependencies());
|
||||
QVector<Node*> duplicated = Node::CopyDependencyGraph(nodes_to_clone, splice_split_command_);
|
||||
trim_in_ = static_cast<Block*>(duplicated.first());
|
||||
} else {
|
||||
trim_in_ = static_cast<Block*>(trim_out_->copy());
|
||||
new NodeAddCommand(static_cast<NodeGraph*>(track_->parent()), trim_in_, splice_split_command_);
|
||||
new NodeCopyInputsCommand(trim_out_, trim_in_, true, splice_split_command_);
|
||||
}
|
||||
|
||||
splice_split_command_->redo();
|
||||
|
||||
trim_out_old_length_ = trim_out_->length();
|
||||
trim_out_->set_length_and_media_out(in_ - trim_out_->in());
|
||||
|
||||
trim_in_->set_length_and_media_in(trim_out_old_length_ - (out_ - trim_out_->in()));
|
||||
|
||||
track_->InsertBlockAfter(trim_in_, trim_out_);
|
||||
|
||||
}
|
||||
|
||||
splice_split_command_->redo();
|
||||
|
||||
trim_out_old_length_ = trim_out_->length();
|
||||
trim_out_->set_length_and_media_out(in_ - trim_out_->in());
|
||||
|
||||
trim_in_->set_length_and_media_in(trim_out_old_length_ - (out_ - trim_out_->in()));
|
||||
|
||||
track_->InsertBlockAfter(trim_in_, trim_out_);
|
||||
|
||||
} else {
|
||||
|
||||
// If we picked up a block to trim the in point of
|
||||
@@ -301,11 +310,20 @@ void TrackRippleRemoveAreaCommand::undo_internal()
|
||||
|
||||
if (splice_) {
|
||||
|
||||
// trim_in_ is our copy and trim_out_ is our original
|
||||
track_->RippleRemoveBlock(trim_in_);
|
||||
trim_out_->set_length_and_media_out(trim_out_old_length_);
|
||||
if (trim_out_->type() == Block::kGap) {
|
||||
|
||||
splice_split_command_->undo();
|
||||
// Just restore the length
|
||||
trim_out_->set_length_and_media_out(trim_out_->length() + (out_ - in_));
|
||||
|
||||
} else {
|
||||
|
||||
// trim_in_ is our copy and trim_out_ is our original
|
||||
track_->RippleRemoveBlock(trim_in_);
|
||||
trim_out_->set_length_and_media_out(trim_out_old_length_);
|
||||
|
||||
splice_split_command_->undo();
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user