From 09eb07ad0b8d23e6b2b9d30678bd8459144cea8e Mon Sep 17 00:00:00 2001 From: Jean Felder Date: Mon, 16 Dec 2024 17:50:43 +0100 Subject: [PATCH] qgs3dmapscene: Show an error message if export operation failed --- src/3d/qgs3dmapscene.cpp | 7 ++++++- tests/src/3d/testqgs3drendering.cpp | 3 ++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/3d/qgs3dmapscene.cpp b/src/3d/qgs3dmapscene.cpp index 0b186e8828973..95ec142c7f8c4 100644 --- a/src/3d/qgs3dmapscene.cpp +++ b/src/3d/qgs3dmapscene.cpp @@ -1045,7 +1045,12 @@ void Qgs3DMapScene::exportScene( const Qgs3DMapExportSettings &exportSettings ) if ( mTerrain ) exporter.parseTerrain( mTerrain, "Terrain" ); - exporter.save( exportSettings.sceneName(), exportSettings.sceneFolderPath() ); + const bool sceneSaved = exporter.save( exportSettings.sceneName(), exportSettings.sceneFolderPath() ); + if ( !sceneSaved ) + { + QgsMessageOutput::showMessage( tr( "3D exporter warning" ), tr( "The scene can not be exported." ), QgsMessageOutput::MessageText ); + return; + } if ( !notParsedLayers.empty() ) { diff --git a/tests/src/3d/testqgs3drendering.cpp b/tests/src/3d/testqgs3drendering.cpp index 3e462f32a2912..a12d746aa6f0e 100644 --- a/tests/src/3d/testqgs3drendering.cpp +++ b/tests/src/3d/testqgs3drendering.cpp @@ -2274,7 +2274,8 @@ void TestQgs3DRendering::do3DSceneExport( const QString &testName, int zoomLevel exporter.parseTerrain( terrainEntity, "DEM_Tile" ); QString objFileName = QString( "%1-%2" ).arg( testName ).arg( zoomLevelsCount ); - exporter.save( objFileName, QDir::tempPath(), 3 ); + const bool saved = exporter.save( objFileName, QDir::tempPath(), 3 ); + QVERIFY( saved ); int sum = 0; for ( auto o : qAsConst( exporter.mObjects ) )