From 186ea0bc8cad7b15e9827b21600b844cf0e0092c Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 5 Dec 2019 14:08:36 +0100 Subject: [PATCH 1/9] Fix Edit_polyhedron_plugin --- .../Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp index e15b5185976..20218416415 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp @@ -909,6 +909,8 @@ bool Scene_edit_polyhedron_item::eventFilter(QObject* /*target*/, QEvent *event) // check state changes between old and current state bool ctrl_pressed_now = d->state.ctrl_pressing && !old_state.ctrl_pressing; bool ctrl_released_now = !d->state.ctrl_pressing && old_state.ctrl_pressing; + if(ctrl_released_now) //to avoid moving the control vertices next time ctrl is pressed + d->state.left_button_pressing = false; if(ctrl_pressed_now || ctrl_released_now || event->type() == QEvent::HoverMove) {// activate a handle manipulated frame CGAL::QGLViewer* viewer = Three::mainViewer(); From b3393db2bc2db469c12947fda5a0bc1a846e15fa Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 5 Dec 2019 14:18:12 +0100 Subject: [PATCH 2/9] fix filter for & --- Polyhedron/demo/Polyhedron/MainWindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index 9fb344a24b3..872860fa292 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -451,7 +451,7 @@ void filterMenuOperations(QMenu* menu, QString filter, bool keep_from_here) action->setVisible(!(submenu->isEmpty())); } - else if(action->text().contains(filter, Qt::CaseInsensitive)){ + else if(action->text().remove("&").contains(filter, Qt::CaseInsensitive)){ //menu->addAction(action); addActionToMenu(action, menu); } @@ -491,7 +491,7 @@ void MainWindow::filterOperations(bool) Q_FOREACH(const PluginNamePair& p, plugins) { Q_FOREACH(QAction* action, p.first->actions()) { action->setVisible( p.first->applicable(action) - && (action->text().contains(filter, Qt::CaseInsensitive) + && (action->text().remove("&").contains(filter, Qt::CaseInsensitive) || action->property("subMenuName") .toString().contains(filter, Qt::CaseInsensitive))); } From fb25130e6a0ed8fdbe9d9b342ea6a7bf65491a0f Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 5 Dec 2019 15:38:41 +0100 Subject: [PATCH 3/9] fix crash at loading when alpha is not 1 --- Polyhedron/demo/Polyhedron/Scene.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Polyhedron/demo/Polyhedron/Scene.cpp b/Polyhedron/demo/Polyhedron/Scene.cpp index 05998239946..5425285d9ed 100644 --- a/Polyhedron/demo/Polyhedron/Scene.cpp +++ b/Polyhedron/demo/Polyhedron/Scene.cpp @@ -84,9 +84,12 @@ Scene::addItem(CGAL::Three::Scene_item* item) addGroup(group); //init the item for the mainViewer to avoid using unexisting //VAOs if the mainViewer is not the first to be drawn. + QOpenGLFramebufferObject* fbo = CGAL::Three::Three::mainViewer()->depthPeelingFbo(); + CGAL::Three::Three::mainViewer()->setDepthPeelingFbo(nullptr);//to prevent crashing as the fbo is not initialized in this call. item->draw(CGAL::Three::Three::mainViewer()); item->drawEdges(CGAL::Three::Three::mainViewer()); item->drawPoints(CGAL::Three::Three::mainViewer()); + CGAL::Three::Three::mainViewer()->setDepthPeelingFbo(fbo); return id; } From 504a3ad0f5ea09287bc33f7e86fef674bdf745be Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Fri, 13 Dec 2019 12:12:51 +0100 Subject: [PATCH 4/9] add some copies in the copy constructor to fix crash of cloning colored items --- Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp b/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp index a25bd48cadf..7b6febf0ff9 100644 --- a/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp +++ b/Polyhedron/demo/Polyhedron/Scene_surface_mesh_item.cpp @@ -102,7 +102,10 @@ struct Scene_surface_mesh_item_priv{ Scene_surface_mesh_item_priv(const Scene_surface_mesh_item& other, Scene_surface_mesh_item* parent): smesh_(new SMesh(*other.d->smesh_)), idx_data_(other.d->idx_data_), - idx_edge_data_(other.d->idx_edge_data_) + idx_edge_data_(other.d->idx_edge_data_), + fpatch_id_map(other.d->fpatch_id_map), + min_patch_id(other.d->min_patch_id), + colors_(other.d->colors_) { item = parent; item->setTriangleContainer(1, new Triangle_container(VI::PROGRAM_WITH_LIGHT, From 3c913274211f63bc536b1c7d31c88f0a998e4a88 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 19 Dec 2019 09:39:14 +0100 Subject: [PATCH 5/9] Fix clip poly plugin. --- .../Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp index 1585e3c0fad..4750f6ef4a5 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Operations_on_polyhedra/Clip_polyhedron_plugin.cpp @@ -91,7 +91,8 @@ public : //get the references this->scene = scene_interface; this->messages = mi; - plane = NULL; + plane = nullptr; + clipper_item = nullptr; //creates and link the actions actionClipPolyhedra = new QAction("Clip Polyhedra With Plane", mw); actionClipPolyhedra->setProperty("subMenuName","Polygon Mesh Processing/Corefinement"); From 2c9cb4475efb088487f616db616b2abed26bd9bd Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Thu, 2 Jan 2020 11:03:14 +0100 Subject: [PATCH 6/9] If no loader is found for the requiered extension, offer all io plugins in the dialog instead of none --- Polyhedron/demo/Polyhedron/MainWindow.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index 872860fa292..31bef8c34a5 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -1197,6 +1197,10 @@ void MainWindow::open(QString filename) selected_items << io_plugin->name(); } } + //if no plugin is correct, offer them all. + for(CGAL::Three::Polyhedron_demo_io_plugin_interface* io_plugin : io_plugins) { + all_items << io_plugin->name(); + } } else selected_items << *dfs_it; From fc7ef12c041964826cebe3be82145e8cf1427fc0 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 8 Jan 2020 10:16:51 +0100 Subject: [PATCH 7/9] Force transparency_pass_number to 4 minimum in readSettings(), in case a preferences file is corrupted. --- Polyhedron/demo/Polyhedron/MainWindow.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index 31bef8c34a5..3dcffce3ad5 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -1808,7 +1808,9 @@ void MainWindow::readSettings() viewer->setFastDrawing(settings.value("quick_camera_mode", true).toBool()); scene->enableVisibilityRecentering(settings.value("offset_update", false).toBool()); viewer->textRenderer()->setMax(settings.value("max_text_items", 10000).toInt()); - viewer->setTotalPass(settings.value("transparency_pass_number", 4).toInt()); + int val = settings.value("transparency_pass_number", 4).toInt(); + if (val < 4 ) val = 4; + viewer->setTotalPass(val); CGAL::Three::Three::s_defaultSMRM = CGAL::Three::Three::modeFromName( settings.value("default_sm_rm", "flat+edges").toString()); CGAL::Three::Three::s_defaultPSRM = CGAL::Three::Three::modeFromName( From 81cb46a8f53904f25c8a6f3ea8dcde7e1c0bbc73 Mon Sep 17 00:00:00 2001 From: Maxime GIMENO Date: Wed, 8 Jan 2020 10:32:31 +0100 Subject: [PATCH 8/9] Update Polyhedron/demo/Polyhedron/MainWindow.cpp Co-Authored-By: Laurent Rineau --- Polyhedron/demo/Polyhedron/MainWindow.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index 3dcffce3ad5..ca9c2e75e00 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -1809,7 +1809,10 @@ void MainWindow::readSettings() scene->enableVisibilityRecentering(settings.value("offset_update", false).toBool()); viewer->textRenderer()->setMax(settings.value("max_text_items", 10000).toInt()); int val = settings.value("transparency_pass_number", 4).toInt(); - if (val < 4 ) val = 4; + if (val < 4 ) { + val = 4; + settings.setValue("transparency_pass_number", 4); + } viewer->setTotalPass(val); CGAL::Three::Three::s_defaultSMRM = CGAL::Three::Three::modeFromName( settings.value("default_sm_rm", "flat+edges").toString()); From 86759b31722f222badf90e2e97264efcd44f57a3 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Mon, 13 Jan 2020 10:38:30 +0100 Subject: [PATCH 9/9] Fix lookat --- Polyhedron/demo/Polyhedron/MainWindow.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index ca9c2e75e00..a076d16bea4 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -3166,9 +3166,9 @@ void SubViewer::lookat() if (viewer->camera()->frame()->isSpinning()) viewer->camera()->frame()->stopSpinning(); mw->viewerShow(viewer, - (float)dialog.get_x(), - (float)dialog.get_y(), - (float)dialog.get_z()); + (float)dialog.get_x() + viewer->offset().x, + (float)dialog.get_y() + viewer->offset().y, + (float)dialog.get_z() + viewer->offset().z); } }