Skip to content

Commit 50fe804

Browse files
authored
Lab - fix "save as" for a c3t3 that was loaded (#8940)
## Summary of Changes Load a `.mesh` file, remesh it or do nothing, and "save as..." fails because the `c3t3` has its `is_valid` field set to `false`. This PR fixes that issue : now only `.binary.cgal` requires being certainly valid, i.e. generated by Mesh_3 thanks @IasonManolas for the report ## Release Management * Affected package(s): Lab * License and copyright ownership: unchanged
2 parents b7b8e8f + 16ff0ba commit 50fe804

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

Lab/demo/Lab/Plugins/Mesh_3/C3t3_io_plugin.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -196,24 +196,23 @@ CGAL_Lab_c3t3_binary_io_plugin::
196196
save(QFileInfo fileinfo, QList<Scene_item *> &items)
197197
{
198198
Scene_item* item = items.front();
199-
if(!qobject_cast<Scene_c3t3_item*>(item)->is_valid())
200-
{
201-
QMessageBox::warning(CGAL::Three::Three::mainWindow(), "", "The c3t3_item is not valid. You cannot save it.");
202-
return false;
203-
}
204199
const Scene_c3t3_item* c3t3_item = qobject_cast<const Scene_c3t3_item*>(item);
205-
if ( NULL == c3t3_item )
206-
{
200+
if(nullptr == c3t3_item) {
207201
return false;
208202
}
209203

210204
QString path = fileinfo.absoluteFilePath();
211205

212206
if(path.endsWith(".cgal"))
213207
{
208+
if(!c3t3_item->is_valid())
209+
{
210+
QMessageBox::warning(CGAL::Three::Three::mainWindow(), "",
211+
"The c3t3_item is not valid. You cannot save it in binary cgal format.");
212+
return false;
213+
}
214214
std::ofstream out(fileinfo.filePath().toUtf8(),
215215
std::ios_base::out|std::ios_base::binary);
216-
217216
bool ok = out && c3t3_item->save_binary(out);
218217
if(!ok)
219218
return false;

0 commit comments

Comments
 (0)