fixed transition copying
This commit is contained in:
+7
-2
@@ -637,6 +637,12 @@ Clip* Timeline::split_clip(ComboAction* ca, int p, long frame, long post_in) {
|
||||
ca->append(new MoveClipAction(pre, pre->timeline_in, frame, pre->clip_in, pre->track));
|
||||
|
||||
if (pre->get_opening_transition() != NULL) {
|
||||
/*if (frame < pre->timeline_in + pre->get_opening_transition()->length && pre->get_opening_transition()->secondary_clip != NULL) {
|
||||
// separate shared transition
|
||||
ca->append(new SetPointer((void**) &pre->get_opening_transition()->secondary_clip, NULL));
|
||||
pre->get_opening_transition()->secondary_clip->closing_transition = pre->get_opening_transition()->copy(pre->get_opening_transition()->secondary_clip, NULL);
|
||||
}*/
|
||||
|
||||
if (pre->get_opening_transition()->length > new_clip_length) {
|
||||
ca->append(new ModifyTransitionCommand(pre, TA_OPENING_TRANSITION, new_clip_length));
|
||||
}
|
||||
@@ -645,8 +651,7 @@ Clip* Timeline::split_clip(ComboAction* ca, int p, long frame, long post_in) {
|
||||
}
|
||||
if (pre->get_closing_transition() != NULL) {
|
||||
ca->append(new DeleteTransitionCommand(pre, TA_CLOSING_TRANSITION));
|
||||
|
||||
post->get_closing_transition()->length = qMin((long) post->get_closing_transition()->length, post->getLength());
|
||||
if (pre->get_closing_transition()->secondary_clip == NULL) post->get_closing_transition()->length = qMin((long) post->get_closing_transition()->length, post->getLength());
|
||||
}
|
||||
|
||||
return post;
|
||||
|
||||
@@ -26,7 +26,7 @@ extern "C" {
|
||||
#include <QOpenGLFramebufferObject>
|
||||
|
||||
#ifdef QT_DEBUG
|
||||
#define GCF_DEBUG
|
||||
//#define GCF_DEBUG
|
||||
#endif
|
||||
|
||||
bool texture_failed = false;
|
||||
|
||||
+4
-4
@@ -66,8 +66,8 @@ Clip* Clip::copy(Sequence* s) {
|
||||
}
|
||||
|
||||
// TODO make a replacemennt for this somehow
|
||||
//if (opening_transition != -1) copy->opening_transition = this->sequence->transitions.at(opening_transition)->copy(copy);
|
||||
//if (closing_transition != -1) copy->closing_transition = this->sequence->transitions.at(closing_transition)->copy(copy);
|
||||
if (get_opening_transition() != NULL && get_opening_transition()->secondary_clip == NULL) copy->opening_transition = get_opening_transition()->copy(copy, NULL);
|
||||
if (get_closing_transition() != NULL && get_closing_transition()->secondary_clip == NULL) copy->closing_transition = get_closing_transition()->copy(copy, NULL);
|
||||
|
||||
copy->recalculateMaxLength();
|
||||
|
||||
@@ -169,8 +169,8 @@ Clip::~Clip() {
|
||||
}
|
||||
}
|
||||
|
||||
//if (opening_transition != -1) this->sequence->hard_delete_transition(this, TA_OPENING_TRANSITION);
|
||||
//if (closing_transition != -1) this->sequence->hard_delete_transition(this, TA_CLOSING_TRANSITION);
|
||||
if (opening_transition != -1) this->sequence->hard_delete_transition(this, TA_OPENING_TRANSITION);
|
||||
if (closing_transition != -1) this->sequence->hard_delete_transition(this, TA_CLOSING_TRANSITION);
|
||||
|
||||
for (int i=0;i<effects.size();i++) {
|
||||
delete effects.at(i);
|
||||
|
||||
@@ -484,6 +484,7 @@ void AddClipCommand::undo() {
|
||||
Clip* c = seq->clips.last();
|
||||
panel_timeline->deselect_area(c->timeline_in, c->timeline_out, c->track);
|
||||
undone_clips.prepend(c);
|
||||
if (c->open) close_clip(c);
|
||||
seq->clips.removeLast();
|
||||
}
|
||||
mainWindow->setWindowModified(old_project_changed);
|
||||
@@ -504,6 +505,8 @@ void AddClipCommand::redo() {
|
||||
for (int j=0;j<original->linked.size();j++) {
|
||||
copy->linked[j] = original->linked.at(j) + linkOffset;
|
||||
}
|
||||
if (original->opening_transition > -1) copy->opening_transition = original->get_opening_transition()->copy(copy, NULL);
|
||||
if (original->closing_transition > -1) copy->closing_transition = original->get_closing_transition()->copy(copy, NULL);
|
||||
seq->clips.append(copy);
|
||||
}
|
||||
}
|
||||
|
||||
+66
-53
@@ -594,30 +594,28 @@ void TimelineWidget::mousePressEvent(QMouseEvent *event) {
|
||||
panel_timeline->deselect_area(link->timeline_in, link->timeline_out, link->track);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (panel_timeline->transition_select != TA_NO_TRANSITION) {
|
||||
panel_timeline->deselect_area(clip->timeline_in, clip->timeline_out, clip->track);
|
||||
} else if (panel_timeline->tool == TIMELINE_TOOL_POINTER && panel_timeline->transition_select != TA_NO_TRANSITION) {
|
||||
panel_timeline->deselect_area(clip->timeline_in, clip->timeline_out, clip->track);
|
||||
|
||||
for (int i=0;i<clip->linked.size();i++) {
|
||||
Clip* link = sequence->clips.at(clip->linked.at(i));
|
||||
panel_timeline->deselect_area(link->timeline_in, link->timeline_out, link->track);
|
||||
}
|
||||
for (int i=0;i<clip->linked.size();i++) {
|
||||
Clip* link = sequence->clips.at(clip->linked.at(i));
|
||||
panel_timeline->deselect_area(link->timeline_in, link->timeline_out, link->track);
|
||||
}
|
||||
|
||||
Selection s;
|
||||
s.track = clip->track;
|
||||
Selection s;
|
||||
s.track = clip->track;
|
||||
|
||||
if (panel_timeline->transition_select == TA_OPENING_TRANSITION && clip->get_opening_transition() != NULL) {
|
||||
s.in = clip->timeline_in;
|
||||
if (clip->get_opening_transition()->secondary_clip != NULL) s.in -= clip->get_opening_transition()->length;
|
||||
s.out = clip->timeline_in + clip->get_opening_transition()->length;
|
||||
} else if (panel_timeline->transition_select == TA_CLOSING_TRANSITION && clip->get_closing_transition() != NULL) {
|
||||
s.in = clip->timeline_out - clip->get_closing_transition()->length;
|
||||
s.out = clip->timeline_out;
|
||||
if (clip->get_closing_transition()->secondary_clip != NULL) s.out += clip->get_closing_transition()->length;
|
||||
}
|
||||
sequence->selections.append(s);
|
||||
}
|
||||
}
|
||||
if (panel_timeline->transition_select == TA_OPENING_TRANSITION && clip->get_opening_transition() != NULL) {
|
||||
s.in = clip->timeline_in;
|
||||
if (clip->get_opening_transition()->secondary_clip != NULL) s.in -= clip->get_opening_transition()->length;
|
||||
s.out = clip->timeline_in + clip->get_opening_transition()->length;
|
||||
} else if (panel_timeline->transition_select == TA_CLOSING_TRANSITION && clip->get_closing_transition() != NULL) {
|
||||
s.in = clip->timeline_out - clip->get_closing_transition()->length;
|
||||
s.out = clip->timeline_out;
|
||||
if (clip->get_closing_transition()->secondary_clip != NULL) s.out += clip->get_closing_transition()->length;
|
||||
}
|
||||
sequence->selections.append(s);
|
||||
}
|
||||
} else {
|
||||
// if "shift" is not down
|
||||
if (!shift) {
|
||||
@@ -629,15 +627,17 @@ void TimelineWidget::mousePressEvent(QMouseEvent *event) {
|
||||
s.in = clip->timeline_in;
|
||||
s.out = clip->timeline_out;
|
||||
|
||||
if (panel_timeline->transition_select == TA_OPENING_TRANSITION) {
|
||||
s.out = clip->timeline_in + clip->get_opening_transition()->length;
|
||||
if (clip->get_opening_transition()->secondary_clip != NULL) s.in -= clip->get_opening_transition()->length;
|
||||
}
|
||||
if (panel_timeline->tool == TIMELINE_TOOL_POINTER) {
|
||||
if (panel_timeline->transition_select == TA_OPENING_TRANSITION) {
|
||||
s.out = clip->timeline_in + clip->get_opening_transition()->length;
|
||||
if (clip->get_opening_transition()->secondary_clip != NULL) s.in -= clip->get_opening_transition()->length;
|
||||
}
|
||||
|
||||
if (panel_timeline->transition_select == TA_CLOSING_TRANSITION) {
|
||||
s.in = clip->timeline_out - clip->get_closing_transition()->length;
|
||||
if (clip->get_closing_transition()->secondary_clip != NULL) s.out += clip->get_closing_transition()->length;
|
||||
}
|
||||
if (panel_timeline->transition_select == TA_CLOSING_TRANSITION) {
|
||||
s.in = clip->timeline_out - clip->get_closing_transition()->length;
|
||||
if (clip->get_closing_transition()->secondary_clip != NULL) s.out += clip->get_closing_transition()->length;
|
||||
}
|
||||
}
|
||||
|
||||
s.track = clip->track;
|
||||
sequence->selections.append(s);
|
||||
@@ -1001,16 +1001,16 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
const Ghost& g = panel_timeline->ghosts.at(0);
|
||||
|
||||
if (g.in != g.out) {
|
||||
Clip* c = sequence->clips.at(g.clip);
|
||||
|
||||
long transition_start = qMin(g.in, g.out);
|
||||
long transition_end = qMax(g.in, g.out);
|
||||
|
||||
make_room_for_transition(ca, c, panel_timeline->transition_tool_type, transition_start, transition_end, true);
|
||||
Clip* pre = sequence->clips.at(g.clip);
|
||||
Clip* post = pre;
|
||||
|
||||
make_room_for_transition(ca, pre, panel_timeline->transition_tool_type, transition_start, transition_end, true);
|
||||
|
||||
if (panel_timeline->transition_tool_post_clip > -1) {
|
||||
Clip* pre = c;
|
||||
Clip* post = sequence->clips.at(panel_timeline->transition_tool_post_clip);
|
||||
post = sequence->clips.at(panel_timeline->transition_tool_post_clip);
|
||||
int opposite_type = (panel_timeline->transition_tool_type == TA_OPENING_TRANSITION) ? TA_CLOSING_TRANSITION : TA_OPENING_TRANSITION;
|
||||
make_room_for_transition(
|
||||
ca,
|
||||
@@ -1020,33 +1020,47 @@ void TimelineWidget::mouseReleaseEvent(QMouseEvent *event) {
|
||||
transition_end,
|
||||
true
|
||||
);
|
||||
|
||||
if (panel_timeline->transition_tool_type == TA_CLOSING_TRANSITION) {
|
||||
// swap
|
||||
Clip* temp = pre;
|
||||
pre = post;
|
||||
post = temp;
|
||||
}
|
||||
ca->append(new AddTransitionCommand(pre, post, panel_timeline->transition_tool_meta, TA_OPENING_TRANSITION, transition_end - pre->timeline_in));
|
||||
} else {
|
||||
if (transition_start < c->timeline_in || transition_end > c->timeline_out) {
|
||||
// delete shit over there and extend timeline in
|
||||
QVector<Selection> areas;
|
||||
Selection s;
|
||||
if (transition_start < c->timeline_in) {
|
||||
s.in = transition_start;
|
||||
s.out = c->timeline_in;
|
||||
} else if (transition_end > c->timeline_out) {
|
||||
s.in = c->timeline_out;
|
||||
s.out = transition_end;
|
||||
}
|
||||
s.track = c->track;
|
||||
areas.append(s);
|
||||
}
|
||||
|
||||
panel_timeline->delete_areas_and_relink(ca, areas);
|
||||
ca->append(new MoveClipAction(c, qMin(transition_start, c->timeline_in), qMax(transition_end, c->timeline_out), c->clip_in, c->track));
|
||||
if (transition_start < post->timeline_in || transition_end > pre->timeline_out) {
|
||||
// delete shit over there and extend timeline in
|
||||
QVector<Selection> areas;
|
||||
Selection s;
|
||||
s.track = post->track;
|
||||
|
||||
bool move_post = false;
|
||||
bool move_pre = false;
|
||||
|
||||
if (transition_start < post->timeline_in) {
|
||||
s.in = transition_start;
|
||||
s.out = post->timeline_in;
|
||||
areas.append(s);
|
||||
move_post = true;
|
||||
}
|
||||
if (transition_end > pre->timeline_out) {
|
||||
s.in = pre->timeline_out;
|
||||
s.out = transition_end;
|
||||
areas.append(s);
|
||||
move_pre = true;
|
||||
}
|
||||
|
||||
ca->append(new AddTransitionCommand(c, NULL, panel_timeline->transition_tool_meta, panel_timeline->transition_tool_type, transition_end - transition_start));
|
||||
panel_timeline->delete_areas_and_relink(ca, areas);
|
||||
|
||||
if (move_post) ca->append(new MoveClipAction(post, qMin(transition_start, post->timeline_in), post->timeline_out, post->clip_in - (post->timeline_in - transition_start), post->track));
|
||||
if (move_pre) ca->append(new MoveClipAction(pre, pre->timeline_in, qMax(transition_end, pre->timeline_out), pre->clip_in, pre->track));
|
||||
}
|
||||
|
||||
if (panel_timeline->transition_tool_post_clip > -1) {
|
||||
ca->append(new AddTransitionCommand(pre, post, panel_timeline->transition_tool_meta, TA_OPENING_TRANSITION, transition_end - pre->timeline_in));
|
||||
} else {
|
||||
ca->append(new AddTransitionCommand(pre, NULL, panel_timeline->transition_tool_meta, panel_timeline->transition_tool_type, transition_end - transition_start));
|
||||
}
|
||||
|
||||
push_undo = true;
|
||||
@@ -1339,7 +1353,6 @@ void TimelineWidget::update_ghosts(const QPoint& mouse_pos, bool lock_frame) {
|
||||
if (validator < 0) frame_diff += validator; // prevent from going below 0 for the media
|
||||
|
||||
validator = otc->clip_in + frame_diff - otc->getMaximumLength();
|
||||
dout << validator << otc->getMaximumLength();
|
||||
if (validator > 0) frame_diff -= validator; // prevent transition from exceeding media length
|
||||
} else {
|
||||
validator = otc->clip_in + frame_diff;
|
||||
|
||||
Reference in New Issue
Block a user