From 615ce8ef79df36931f3ec324d7f8f8d69242409e Mon Sep 17 00:00:00 2001 From: Thomas Wilshaw Date: Wed, 23 Sep 2020 17:50:31 +0100 Subject: [PATCH 1/2] Fix Issue #1218 Add an error message if there is no active sequence. Selected a Sequence panel as opposed to a generic time based panel as we will only ever export a sequence. Also makes error logic slightly easier. --- app/core.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/app/core.cpp b/app/core.cpp index 5ba51ee45..a9c0d659f 100644 --- a/app/core.cpp +++ b/app/core.cpp @@ -355,18 +355,23 @@ void Core::DialogProjectPropertiesShow() void Core::DialogExportShow() { - TimeBasedPanel* latest_time_based = PanelManager::instance()->MostRecentlyFocused(); + SequenceViewerPanel* latest_sequence = PanelManager::instance()->MostRecentlyFocused(); - if (latest_time_based && latest_time_based->GetConnectedViewer()) { - if (latest_time_based->GetConnectedViewer()->GetLength() == 0) { + if (latest_sequence && latest_sequence->GetConnectedViewer()) { + if (latest_sequence->GetConnectedViewer()->GetLength() == 0) { QMessageBox::critical(main_window_, tr("Error"), tr("This Sequence is empty. There is nothing to export."), QMessageBox::Ok); } else { - ExportDialog ed(latest_time_based->GetConnectedViewer(), main_window_); + ExportDialog ed(latest_sequence->GetConnectedViewer(), main_window_); ed.exec(); } + } else { + QMessageBox::critical(main_window_, + tr("Error"), + tr("No valid sequence detected.\nMake sure a sequence is loaded and it has a connected Viewer node."), + QMessageBox::Ok); } } From 378708c9d350fe98b5bca255dc63cf7996089924 Mon Sep 17 00:00:00 2001 From: Thomas Wilshaw Date: Thu, 24 Sep 2020 17:46:11 +0100 Subject: [PATCH 2/2] Exporter falls back to timeline if all else fails If no recent TimeBasedPanel can be found the exporter defaults to the first timeline. If this also fails an error is shown. --- app/core.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/app/core.cpp b/app/core.cpp index a9c0d659f..432fb10bb 100644 --- a/app/core.cpp +++ b/app/core.cpp @@ -355,22 +355,29 @@ void Core::DialogProjectPropertiesShow() void Core::DialogExportShow() { - SequenceViewerPanel* latest_sequence = PanelManager::instance()->MostRecentlyFocused(); + // First try the most recently focused time based window + TimeBasedPanel* time_panel = PanelManager::instance()->MostRecentlyFocused(); - if (latest_sequence && latest_sequence->GetConnectedViewer()) { - if (latest_sequence->GetConnectedViewer()->GetLength() == 0) { + // If that fails try defaulting to the first timeline (i.e. if a project has just been loaded). + if (!time_panel->GetConnectedViewer()) { + // Safe to assume there will always be one timeline. + time_panel = PanelManager::instance()->GetPanelsOfType().first(); + } + + if (time_panel && time_panel->GetConnectedViewer()) { + if (time_panel->GetConnectedViewer()->GetLength() == 0) { QMessageBox::critical(main_window_, tr("Error"), tr("This Sequence is empty. There is nothing to export."), QMessageBox::Ok); } else { - ExportDialog ed(latest_sequence->GetConnectedViewer(), main_window_); + ExportDialog ed(time_panel->GetConnectedViewer(), main_window_); ed.exec(); } } else { QMessageBox::critical(main_window_, tr("Error"), - tr("No valid sequence detected.\nMake sure a sequence is loaded and it has a connected Viewer node."), + tr("No valid sequence detected.\n\nMake sure a sequence is loaded and it has a connected Viewer node."), QMessageBox::Ok); } }