Merge pull request #4218 from maxGimeno/Demo-Fixes-GF

CGAL 3D Demo: Some more fixes
This commit is contained in:
Laurent Rineau 2019-09-13 12:27:13 +02:00 committed by GitHub
commit 883b3e3d0d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 5 deletions

View File

@ -196,6 +196,11 @@ Polyhedron_demo_c3t3_binary_io_plugin::
save(QFileInfo fileinfo, QList<Scene_item *> &items)
{
Scene_item* item = items.front();
if(!qobject_cast<Scene_c3t3_item*>(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<const Scene_c3t3_item*>(item);
if ( NULL == c3t3_item )
{

View File

@ -565,6 +565,10 @@ void Polyhedron_demo_edit_polyhedron_plugin::importSelection(Scene_polyhedron_se
edit_item->insert_roi_vertex(vh);
}
edit_item->invalidateOpenGLBuffers();
if(selection_item->property("is_highlighting").toBool()){
selection_item->setProperty("need_hl_restore", true);
selection_item->set_highlighting(false);
}
selection_item->setVisible(false);
Q_FOREACH(CGAL::QGLViewer* v, CGAL::QGLViewer::QGLViewerPool())
v->update();
@ -579,14 +583,19 @@ void Polyhedron_demo_edit_polyhedron_plugin::updateSelectionItems(Scene_facegrap
&& sel_item->polyhedron() == target->polyhedron())
{
sel_item->invalidateOpenGLBuffers();
if(!ui_widget.RemeshingCheckBox->isChecked())
if(!ui_widget.RemeshingCheckBox->isChecked()){
sel_item->setVisible(true);
if(sel_item->property("need_hl_restore").toBool()){
sel_item->set_highlighting(true);
sel_item->setProperty("need_hl_restore", false);
}
}
else
scene->erase(scene->item_id(sel_item));
}
}
}
}
}
void Polyhedron_demo_edit_polyhedron_plugin::dispatchAction()
{
if(applicable(actionDeformation))

View File

@ -1964,8 +1964,10 @@ void Scene_polyhedron_selection_item::validateMoveVertex()
viewer->setManipulatedFrame(NULL);
invalidateOpenGLBuffers();
poly_item->itemChanged();
if(property("need_hl_restore").toBool())
if(property("need_hl_restore").toBool()){
set_highlighting(true);
setProperty("need_hl_restore", false);
}
Q_EMIT updateInstructions("Select a vertex. (1/2)");
}

View File

@ -1354,8 +1354,8 @@ QOpenGLShaderProgram* Viewer::getShaderProgram(int name) const
return 0;
}
QOpenGLShaderProgram* program = declare_program(name,
":/cgal/Polyhedron_3/resources/solid_wireframe_shader.vert",
":/cgal/Polyhedron_3/resources/solid_wireframe_shader.frag");
":/cgal/Polyhedron_3/resources/no_interpolation_shader.vert",
":/cgal/Polyhedron_3/resources/no_interpolation_shader.frag");
program->setProperty("hasLight", true);
program->setProperty("hasNormals", true);
program->setProperty("drawLinesAdjacency", true);