fixed transition glitches

This commit is contained in:
itsmattkc
2018-12-30 22:54:26 +11:00
parent f44cf37337
commit 1204a69baa
5 changed files with 57 additions and 7 deletions
+8
View File
@@ -767,6 +767,10 @@ void MainWindow::setup_menus() {
tools_menu->addAction("Preferences", this, SLOT(preferences()), QKeySequence("Ctrl+."));
#ifdef QT_DEBUG
tools_menu->addAction("Clear Undo", this, SLOT(clear_undo_stack()), QKeySequence("Ctrl+."));
#endif
// INITIALIZE HELP MENU
QMenu* help_menu = menuBar->addMenu("&Help");
@@ -815,6 +819,10 @@ void MainWindow::paintEvent(QPaintEvent *event) {
#endif
}
void MainWindow::clear_undo_stack() {
undo_stack.clear();
}
void MainWindow::open_project() {
QString fn = QFileDialog::getOpenFileName(this, "Open Project...", "", OLIVE_FILE_FILTER);
if (!fn.isEmpty() && can_close_project()) {
+2
View File
@@ -35,6 +35,8 @@ protected:
void paintEvent(QPaintEvent *event);
private slots:
void clear_undo_stack();
void show_about();
void delete_slot();
void select_all();
+14 -6
View File
@@ -61,13 +61,21 @@ void Sequence::hard_delete_transition(Clip *c, int type) {
Transition* t = transitions.at(transition_index);
if (t->secondary_clip != NULL) {
if (type == TA_OPENING_TRANSITION) {
// convert to closing transition
t->parent_clip = t->secondary_clip;
}
for (int i=0;i<clips.size();i++) {
Clip* comp = clips.at(i);
if (comp != NULL
&& c != comp
&& (c->opening_transition == transition_index
|| c->closing_transition == transition_index)) {
if (type == TA_OPENING_TRANSITION) {
// convert to closing transition
t->parent_clip = t->secondary_clip;
}
del = false;
t->secondary_clip = NULL;
del = false;
t->secondary_clip = NULL;
}
}
}
if (del) {
+30 -1
View File
@@ -95,6 +95,8 @@ void MoveClipAction::redo() {
DeleteClipAction::DeleteClipAction(Sequence* s, int clip) :
seq(s),
index(clip),
opening_transition(-1),
closing_transition(-1),
old_project_changed(mainWindow->isWindowModified())
{}
@@ -105,13 +107,27 @@ DeleteClipAction::~DeleteClipAction() {
void DeleteClipAction::undo() {
// restore ref to clip
seq->clips[index] = ref;
ref = NULL;
// restore shared transitions
if (opening_transition > -1) {
seq->transitions.at(opening_transition)->secondary_clip = seq->transitions.at(opening_transition)->parent_clip;
seq->transitions.at(opening_transition)->parent_clip = ref;
ref->opening_transition = opening_transition;
opening_transition = -1;
}
if (closing_transition > -1) {
seq->transitions.at(closing_transition)->secondary_clip = ref;
ref->closing_transition = closing_transition;
closing_transition = -1;
}
// restore links to this clip
for (int i=linkClipIndex.size()-1;i>=0;i--) {
seq->clips.at(linkClipIndex.at(i))->linked.insert(linkLinkIndex.at(i), index);
}
ref = NULL;
mainWindow->setWindowModified(old_project_changed);
}
@@ -123,6 +139,19 @@ void DeleteClipAction::redo() {
}
seq->clips[index] = NULL;
// save shared transitions
if (ref->opening_transition > -1 && ref->get_opening_transition()->secondary_clip != NULL) {
opening_transition = ref->opening_transition;
ref->get_opening_transition()->parent_clip = ref->get_opening_transition()->secondary_clip;
ref->get_opening_transition()->secondary_clip = NULL;
ref->opening_transition = -1;
}
if (ref->closing_transition > -1 && ref->get_closing_transition()->secondary_clip != NULL) {
closing_transition = ref->closing_transition;
ref->get_closing_transition()->secondary_clip = NULL;
ref->closing_transition = -1;
}
// delete link to this clip
linkClipIndex.clear();
linkLinkIndex.clear();
+3
View File
@@ -71,6 +71,9 @@ private:
Clip* ref;
int index;
int opening_transition;
int closing_transition;
QVector<int> linkClipIndex;
QVector<int> linkLinkIndex;