From 3ca935d46dd7ab0a274a42a791c1a6349270f018 Mon Sep 17 00:00:00 2001 From: itsmattkc Date: Wed, 6 Mar 2019 11:38:42 -0800 Subject: [PATCH] transition loading correction --- io/loadthread.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/io/loadthread.cpp b/io/loadthread.cpp index d8e1895a3..6b2dc103b 100644 --- a/io/loadthread.cpp +++ b/io/loadthread.cpp @@ -82,8 +82,21 @@ void LoadThread::load_effect(QXmlStreamReader& stream, Clip* c) { } else if (attr.name() == "shared") { // if a transition has this tag, it's sharing a transition with another clip so we don't have to do any processing - Clip* sharing_clip = c->sequence->clips.at(attr.value().toInt()).get(); - if (tag == "opening") { + Clip* sharing_clip = nullptr; + + // Find the clip with the ID referenced in the transition + int clip_id = attr.value().toInt(); + for (int i=0;isequence->clips.size();i++) { + Clip* test_clip = c->sequence->clips.at(i).get(); + if (test_clip->load_id == clip_id) { + sharing_clip = test_clip; + break; + } + } + + if (sharing_clip == nullptr) { + qWarning() << "Failed to link shared transition. Project may be corrupt."; + } else if (tag == "opening") { c->opening_transition = (sharing_clip->closing_transition); // since this is the opened clip, switch secondaries and primaries