diff --git a/app/core.cpp b/app/core.cpp index 8b9859c9b..09ea47e83 100644 --- a/app/core.cpp +++ b/app/core.cpp @@ -383,10 +383,10 @@ void Core::DialogExportShow() } #ifdef USE_OTIO -void Core::DialogImportOTIOShow(const QList& sequences) { +bool Core::DialogImportOTIOShow(const QList& sequences) { Project* active_project = GetActiveProject(); OTIOPropertiesDialog opd(sequences, active_project); - opd.exec(); + return opd.exec() == QDialog::Accepted; } #endif diff --git a/app/core.h b/app/core.h index 5b439a8f0..45e99ee1e 100644 --- a/app/core.h +++ b/app/core.h @@ -402,7 +402,7 @@ public slots: * @brief Show OTIO import dialog */ #ifdef USE_OTIO - void DialogImportOTIOShow(const QList& sequences); + bool DialogImportOTIOShow(const QList& sequences); #endif /** diff --git a/app/dialog/otioproperties/otiopropertiesdialog.cpp b/app/dialog/otioproperties/otiopropertiesdialog.cpp index 9c5794a02..4d9fffc36 100644 --- a/app/dialog/otioproperties/otiopropertiesdialog.cpp +++ b/app/dialog/otioproperties/otiopropertiesdialog.cpp @@ -34,7 +34,8 @@ OTIOPropertiesDialog::OTIOPropertiesDialog(const QList& sequences, Pr { QVBoxLayout* layout = new QVBoxLayout(this); - layout->addWidget(new QLabel(tr("Change settings for each OTIO sequence to be loaded"))); + layout->addWidget(new QLabel(tr("OpenTimelineIO files to not store sequence properties (resolution, framerate etc.).\n" + "Set the correct parameters here or they will be left at the default setting."))); table_ = new QTreeWidget(); table_->setColumnCount(2); @@ -66,7 +67,7 @@ OTIOPropertiesDialog::OTIOPropertiesDialog(const QList& sequences, Pr connect(buttons, &QDialogButtonBox::rejected, this, &OTIOPropertiesDialog::reject); layout->addWidget(buttons); - setWindowTitle(tr("Load OTIO File")); + setWindowTitle(tr("Load OpenTimelineIO File")); } void OTIOPropertiesDialog::SetupSequence() { diff --git a/app/task/project/loadotio/loadotio.cpp b/app/task/project/loadotio/loadotio.cpp index 1b3d82ccf..e5d902df1 100644 --- a/app/task/project/loadotio/loadotio.cpp +++ b/app/task/project/loadotio/loadotio.cpp @@ -97,9 +97,17 @@ bool LoadOTIOTask::Run() // Generate a list of sequences with the same names as the timelines. // Assumes each timeline has a unique name. + int unnamedSequenceCount = 1; foreach (auto timeline, timelines) { Sequence* sequence = new Sequence(); - sequence->SetLabel(QString::fromStdString(timeline->name())); + if (!timeline->name().empty()) { + sequence->SetLabel(QString::fromStdString(timeline->name())); + } else { + // If the otio timeline does not provide a name, create a default one here + QString label = "Sequence " + QString::number(unnamedSequenceCount); + sequence->SetLabel(QString::fromStdString(label.toStdString())); + unnamedSequenceCount++; + } // Set default params incase they aren't edited. sequence->set_default_parameters(); timeline_sequnce_map.insert(timeline, sequence); @@ -112,11 +120,18 @@ bool LoadOTIOTask::Run() } // Dialog has to be called from the main thread so we pass the list of sequences here. + bool accepted = false; QMetaObject::invokeMethod(Core::instance(), "DialogImportOTIOShow", Qt::BlockingQueuedConnection, + Q_RETURN_ARG(bool, accepted), Q_ARG(QList,timeline_sequnce_map.values())); + if (!accepted) { + SetError(tr("Loading OpenTimelineIO file(s) was canceled")); + return false; + } + foreach (auto timeline, timeline_sequnce_map.keys()) { Sequence* sequence = timeline_sequnce_map.value(timeline); sequence->setParent(project_);