From 16ff0ba30a9a3e7ad81853b7983509f4d3e7dc65 Mon Sep 17 00:00:00 2001 From: Jane Tournois Date: Tue, 17 Jun 2025 17:22:33 +0200 Subject: [PATCH] c3t3 is "valid" only if generated by Mesh_3, not if loaded from a .mesh file this disables the demo to save a mesh that was just loaded, or loaded+remeshed for example this commit fixes that bevaviour --- Lab/demo/Lab/Plugins/Mesh_3/C3t3_io_plugin.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Lab/demo/Lab/Plugins/Mesh_3/C3t3_io_plugin.cpp b/Lab/demo/Lab/Plugins/Mesh_3/C3t3_io_plugin.cpp index af885246ea4..69095bf9de4 100644 --- a/Lab/demo/Lab/Plugins/Mesh_3/C3t3_io_plugin.cpp +++ b/Lab/demo/Lab/Plugins/Mesh_3/C3t3_io_plugin.cpp @@ -196,14 +196,8 @@ CGAL_Lab_c3t3_binary_io_plugin:: save(QFileInfo fileinfo, QList &items) { Scene_item* item = items.front(); - if(!qobject_cast(item)->is_valid()) - { - QMessageBox::warning(CGAL::Three::Three::mainWindow(), "", "The c3t3_item is not valid. You cannot save it."); - return false; - } const Scene_c3t3_item* c3t3_item = qobject_cast(item); - if ( NULL == c3t3_item ) - { + if(nullptr == c3t3_item) { return false; } @@ -211,9 +205,14 @@ save(QFileInfo fileinfo, QList &items) if(path.endsWith(".cgal")) { + if(!c3t3_item->is_valid()) + { + QMessageBox::warning(CGAL::Three::Three::mainWindow(), "", + "The c3t3_item is not valid. You cannot save it in binary cgal format."); + return false; + } std::ofstream out(fileinfo.filePath().toUtf8(), std::ios_base::out|std::ios_base::binary); - bool ok = out && c3t3_item->save_binary(out); if(!ok) return false;