diff --git a/src/3d/qgs3dsceneexporter.cpp b/src/3d/qgs3dsceneexporter.cpp index a62ad52cba9eb..8ed99418e37f7 100644 --- a/src/3d/qgs3dsceneexporter.cpp +++ b/src/3d/qgs3dsceneexporter.cpp @@ -808,11 +808,11 @@ Qgs3DExportObject *Qgs3DSceneExporter::processPoints( Qt3DCore::QEntity *entity, return obj; } -void Qgs3DSceneExporter::save( const QString &sceneName, const QString &sceneFolderPath, int precision ) +bool Qgs3DSceneExporter::save( const QString &sceneName, const QString &sceneFolderPath, int precision ) { if ( mObjects.isEmpty() ) { - return; + return false; } const QString objFilePath = QDir( sceneFolderPath ).filePath( sceneName + QStringLiteral( ".obj" ) ); @@ -822,13 +822,13 @@ void Qgs3DSceneExporter::save( const QString &sceneName, const QString &sceneFol if ( !file.open( QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate ) ) { QgsDebugError( QStringLiteral( "Scene can not be exported to '%1'. File access error." ).arg( objFilePath ) ); - return; + return false; } QFile mtlFile( mtlFilePath ); if ( !mtlFile.open( QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate ) ) { QgsDebugError( QStringLiteral( "Scene can not be exported to '%1'. File access error." ).arg( mtlFilePath ) ); - return; + return false; } float maxfloat = std::numeric_limits::max(), minFloat = std::numeric_limits::lowest(); @@ -868,6 +868,7 @@ void Qgs3DSceneExporter::save( const QString &sceneName, const QString &sceneFol } QgsDebugMsgLevel( QStringLiteral( "Scene exported to '%1'" ).arg( objFilePath ), 2 ); + return true; } QString Qgs3DSceneExporter::getObjectName( const QString &name ) diff --git a/src/3d/qgs3dsceneexporter.h b/src/3d/qgs3dsceneexporter.h index cefa70c98aa58..f286d868cde4e 100644 --- a/src/3d/qgs3dsceneexporter.h +++ b/src/3d/qgs3dsceneexporter.h @@ -76,8 +76,11 @@ class _3D_EXPORT Qgs3DSceneExporter : public Qt3DCore::QEntity //! Creates terrain export objects from the terrain entity void parseTerrain( QgsTerrainEntity *terrain, const QString &layer ); - //! Saves the scene to a .obj file - void save( const QString &sceneName, const QString &sceneFolderPath, int precision = 6 ); + /** + * Saves the scene to a .obj file + * Returns FALSE if the operation failed + */ + bool save( const QString &sceneName, const QString &sceneFolderPath, int precision = 6 ); //! Sets whether the triangles will look smooth void setSmoothEdges( bool smoothEdges ) { mSmoothEdges = smoothEdges; }