implemented transition moving

For dual transitions, this will shift around the mid point.
This commit is contained in:
itsmattkc
2020-01-07 02:08:35 +11:00
parent 5d8be03970
commit ee392e11c6
2 changed files with 33 additions and 6 deletions
+18
View File
@@ -23,6 +23,7 @@
#include <float.h>
#include "common/range.h"
#include "node/block/transition/transition.h"
TimelineWidget::Tool::Tool(TimelineWidget *parent) :
dragging_(false),
@@ -101,6 +102,23 @@ rational TimelineWidget::Tool::ValidateFrameMovement(rational movement, const QV
continue;
}
Block* block = Node::ValueToPtr<Block>(ghost->data(TimelineViewGhostItem::kAttachedBlock));
if (block && block->type() == Block::kTransition) {
TransitionBlock* transition = static_cast<TransitionBlock*>(block);
// Daul transitions are only allowed to move so that neither of their offsets are < 0
if (transition->connected_in_block() && transition->connected_out_block()) {
if (movement > transition->out_offset()) {
movement = transition->out_offset();
}
if (movement < -transition->in_offset()) {
movement = -transition->in_offset();
}
}
}
// Prevents any ghosts from going below 0:00:00 time
if (ghost->In() + movement < 0) {
movement = -ghost->In();