otioload: Add simple dialog to change settings

Adds a table of sequences in the OTIO file and allows the settings to
be changed. The dialog takes a list of sequences and relies on each
OTIO timeline having a unique name.

The dialog has to be called from the main thread so there is a wrapper
function in Core.
This commit is contained in:
Thomas Wilshaw
2021-11-09 14:44:51 +00:00
parent 6f55bc01ad
commit 04a0b6024e
7 changed files with 187 additions and 4 deletions
+32 -4
View File
@@ -30,6 +30,7 @@
#include <opentimelineio/transition.h>
#include <QApplication>
#include <QFileInfo>
#include <QThread>
#include "core.h"
#include "node/audio/volume/volume.h"
@@ -88,10 +89,40 @@ bool LoadOTIOTask::Run()
// Keep track of imported footage
QMap<QString, Footage*> imported_footage;
QList<Sequence*> sequences;
// Generate a list of sequences with the same names as the timelines.
// Assumes each timeline has a unique name.
foreach (auto timeline, timelines) {
Sequence* sequence = new Sequence();
sequence->SetLabel(QString::fromStdString(timeline->name()));
// Set default params incase they aren't edited.
sequence->set_default_parameters();
sequences.append(sequence);
}
// Dialog has to be called from the main thread so we pass the list of sequences here.
QMetaObject::invokeMethod(Core::instance(),
"DialogImportOTIOShow",
Qt::BlockingQueuedConnection,
Q_ARG(QList<Sequence*>,sequences));
foreach (auto timeline, timelines) {
// Create sequence
Sequence* sequence = new Sequence();
Sequence* sequence;
// Find correct sequence based on itmeline name.
foreach (Sequence* seq, sequences) {
if (seq->GetLabel() == QString::fromStdString(timeline->name())) {
sequence = seq;
break;
}
}
if (!sequence) {
return false;
}
sequence->SetLabel(QString::fromStdString(timeline->name()));
sequence->setParent(project_);
FolderAddChild(project_->root(), sequence).redo_now();
@@ -102,9 +133,6 @@ bool LoadOTIOTask::Run()
sequence_footage->setParent(project_);
FolderAddChild(project_->root(), sequence_footage).redo_now();
// FIXME: As far as I know, OTIO doesn't store video/audio parameters?
sequence->set_default_parameters();
// Iterate through tracks
for (auto c : timeline->tracks()->children()) {
auto otio_track = static_cast<OTIO::Track*>(c.value);