fixed up validationn issues with transition tool

This commit is contained in:
itsmattkc
2018-11-24 10:59:00 +11:00
parent 48c196bdf5
commit 1414c6a5bb
3 changed files with 21 additions and 4 deletions
+1 -1
View File
@@ -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 {
+8 -3
View File
@@ -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;i<clips.size();i++) {
Clip* cc = clips.at(i);
if (cc != NULL
@@ -64,12 +65,16 @@ void Sequence::hard_delete_transition(Clip *c, int type) {
&& (cc->opening_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 {
+12
View File
@@ -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;