some ripple behavior fixes

This commit is contained in:
itsmattkc
2019-09-21 01:01:15 +10:00
parent 885aee97a2
commit d0d4756129
8 changed files with 45 additions and 6 deletions
@@ -58,6 +58,8 @@ void TimelineViewBlockItem::UpdateRect()
// -1 on width and height so we don't overlap any adjacent clips
setRect(0, y_, item_width - 1, height_ - 1);
setPos(item_left, 0.0);
update();
}
void TimelineViewBlockItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
@@ -84,6 +86,8 @@ void TimelineViewBlockItem::paint(QPainter *painter, const QStyleOptionGraphicsI
painter->drawLine(rect().topLeft(), QPointF(rect().right(), rect().top()));
painter->drawLine(rect().topLeft(), QPointF(rect().left(), rect().bottom() - 1));
painter->drawText(rect(), Qt::AlignLeft | Qt::AlignTop, block_->block_name());
painter->setPen(QColor(64, 64, 64));
painter->drawLine(QPointF(rect().left(), rect().bottom() - 1), QPointF(rect().right(), rect().bottom() - 1));
painter->drawLine(QPointF(rect().right(), rect().bottom() - 1), QPointF(rect().right(), rect().top()));
@@ -29,7 +29,7 @@ TimelineViewGhostItem::TimelineViewGhostItem(QGraphicsItem *parent) :
track_adj_(0),
stream_(nullptr),
mode_(olive::timeline::kNone),
can_have_zero_length_(false)
can_have_zero_length_(true)
{
SetInvisible(false);
}
@@ -45,8 +45,8 @@ TimelineViewGhostItem *TimelineViewGhostItem::FromBlock(Block *block, int track,
ghost->SetHeight(height);
ghost->setData(kAttachedBlock, Node::PtrToValue(block));
if (block->type() == Block::kGap) {
ghost->can_have_zero_length_ = true;
if (block->type() == Block::kClip) {
ghost->can_have_zero_length_ = false;
}
return ghost;
+3 -1
View File
@@ -179,7 +179,9 @@ void TimelineView::ImportTool::DragDrop(QDropEvent *event)
opacity->setParent(&node_memory_manager);
clip->set_length(ghost->Length());
media->SetFootage(ghost->data(TimelineViewGhostItem::kAttachedFootage).value<StreamPtr>());
StreamPtr footage_stream = ghost->data(TimelineViewGhostItem::kAttachedFootage).value<StreamPtr>();
media->SetFootage(footage_stream);
clip->set_block_name(footage_stream->footage()->name());
NodeParam::ConnectEdge(opacity->texture_output(), clip->texture_input());
NodeParam::ConnectEdge(media->texture_output(), opacity->texture_input());
+4 -2
View File
@@ -134,7 +134,9 @@ void TimelineView::RippleTool::InitiateGhosts(TimelineViewBlockItem *clicked_ite
Block* block_before_ripple = track->NearestBlockBefore(earliest_ripple);
// If block is null, there will be no blocks after to ripple
if (block_before_ripple != nullptr && block_before_ripple->type() != Block::kEnd) {
if (block_before_ripple != nullptr
&& block_before_ripple->type() != Block::kEnd
&& block_before_ripple->next()->type() != Block::kEnd) {
TimelineViewGhostItem* ghost;
if (block_before_ripple->type() == Block::kGap) {
@@ -146,7 +148,7 @@ void TimelineView::RippleTool::InitiateGhosts(TimelineViewBlockItem *clicked_ite
ghost->setData(TimelineViewGhostItem::kReferenceBlock, Node::PtrToValue(block_before_ripple));
}
// ghost->SetInvisible(true);
ghost->SetInvisible(true);
}
}
}