From 1414c6a5bbb3ee6dc0c1dc215c1b2ca4fd7c378f Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Sat, 24 Nov 2018 10:59:00 +1100 Subject: [PATCH] fixed up validationn issues with transition tool --- playback/playback.cpp | 2 +- project/sequence.cpp | 11 ++++++++--- ui/timelinewidget.cpp | 12 ++++++++++++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/playback/playback.cpp b/playback/playback.cpp index 3c303299d..96501f94c 100644 --- a/playback/playback.cpp +++ b/playback/playback.cpp @@ -194,7 +194,7 @@ void get_clip_frame(Clip* c, long playhead) { #ifdef GCF_DEBUG dout << "GCF ==> RESET" << target_pts << "(" << target_frame->pts << "-" << target_frame->pts+target_frame->pkt_duration << ")"; #endif -// target_frame = NULL; +// target_frame = NULL; reset = true; c->last_invalid_ts = target_pts; } else { diff --git a/project/sequence.cpp b/project/sequence.cpp index be887693d..f454243a7 100644 --- a/project/sequence.cpp +++ b/project/sequence.cpp @@ -57,6 +57,7 @@ long Sequence::getEndFrame() { void Sequence::hard_delete_transition(Clip *c, int type) { int transition_index = (type == TA_OPENING_TRANSITION) ? c->opening_transition : c->closing_transition; if (transition_index > -1) { + bool del = true; for (int i=0;iopening_transition == transition_index || cc->closing_transition == transition_index)) { // another clip is using this, don't delete just yet - return; + del = false; + break; } } - delete transitions.at(transition_index); - transitions[transition_index] = NULL; + if (del) { + delete transitions.at(transition_index); + transitions[transition_index] = NULL; + } + if (type == TA_OPENING_TRANSITION) { c->opening_transition = -1; } else { diff --git a/ui/timelinewidget.cpp b/ui/timelinewidget.cpp index 3d853e047..e266297f9 100644 --- a/ui/timelinewidget.cpp +++ b/ui/timelinewidget.cpp @@ -1310,6 +1310,13 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { } } } else if (panel_timeline->tool == TIMELINE_TOOL_TRANSITION) { + bool flipped = false; + + if (frame_diff < 0) { + frame_diff = -frame_diff; + flipped = true; + } + Clip* otc = c; // open transition clip Clip* ctc = (panel_timeline->transition_tool_post_clip > -1) ? sequence->clips.at(panel_timeline->transition_tool_post_clip) : NULL; // close transition clip @@ -1327,6 +1334,7 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { } validator = otc->clip_in - frame_diff; + dout << "validator" << validator; if (validator < 0) { // prevent from going below 0 for the media frame_diff += validator; } @@ -1351,6 +1359,10 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) { frame_diff -= validator; } } + + if (flipped) { + frame_diff = -frame_diff; + } } } if (temp_frame_diff != frame_diff) panel_timeline->snapped = false;