If selected_edges is empty, applying mesh_simplification to a selection_item fails with a warning dialog.

This commit is contained in:
Maxime Gimeno 2020-10-20 10:43:46 +02:00
parent 716285945b
commit c093da3077
1 changed files with 6 additions and 1 deletions

View File

@ -8,6 +8,7 @@
#include <QInputDialog>
#include <QElapsedTimer>
#include <QAction>
#include <QMessageBox>
#include <CGAL/Surface_mesh_simplification/edge_collapse.h>
#include <CGAL/Surface_mesh_simplification/Policies/Edge_collapse/Count_stop_predicate.h>
@ -103,7 +104,11 @@ void Polyhedron_demo_mesh_simplification_plugin::on_actionSimplify_triggered()
Scene_polyhedron_selection_item* selection_item =
qobject_cast<Scene_polyhedron_selection_item*>(scene->item(index));
if(selection_item && selection_item->selected_edges.empty())
{
QMessageBox::warning(mw, "Empty Edges", "There are no selected edges. Aborting.");
return;
}
if (poly_item || selection_item)
{
FaceGraph& pmesh = (poly_item != NULL)