Merge pull request #4394 from maxGimeno/Demo-Fixes-maxGimeno

Fixes for the Demo
This commit is contained in:
Laurent Rineau 2020-01-15 17:19:45 +01:00
commit 5a00c3425c
5 changed files with 26 additions and 8 deletions

View File

@ -451,7 +451,7 @@ void filterMenuOperations(QMenu* menu, QString filter, bool keep_from_here)
action->setVisible(!(submenu->isEmpty())); action->setVisible(!(submenu->isEmpty()));
} }
else if(action->text().contains(filter, Qt::CaseInsensitive)){ else if(action->text().remove("&").contains(filter, Qt::CaseInsensitive)){
//menu->addAction(action); //menu->addAction(action);
addActionToMenu(action, menu); addActionToMenu(action, menu);
} }
@ -491,7 +491,7 @@ void MainWindow::filterOperations(bool)
Q_FOREACH(const PluginNamePair& p, plugins) { Q_FOREACH(const PluginNamePair& p, plugins) {
Q_FOREACH(QAction* action, p.first->actions()) { Q_FOREACH(QAction* action, p.first->actions()) {
action->setVisible( p.first->applicable(action) action->setVisible( p.first->applicable(action)
&& (action->text().contains(filter, Qt::CaseInsensitive) && (action->text().remove("&").contains(filter, Qt::CaseInsensitive)
|| action->property("subMenuName") || action->property("subMenuName")
.toString().contains(filter, Qt::CaseInsensitive))); .toString().contains(filter, Qt::CaseInsensitive)));
} }
@ -1197,6 +1197,10 @@ void MainWindow::open(QString filename)
selected_items << io_plugin->name(); 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 else
selected_items << *dfs_it; selected_items << *dfs_it;
@ -1804,7 +1808,12 @@ void MainWindow::readSettings()
viewer->setFastDrawing(settings.value("quick_camera_mode", true).toBool()); viewer->setFastDrawing(settings.value("quick_camera_mode", true).toBool());
scene->enableVisibilityRecentering(settings.value("offset_update", false).toBool()); scene->enableVisibilityRecentering(settings.value("offset_update", false).toBool());
viewer->textRenderer()->setMax(settings.value("max_text_items", 10000).toInt()); 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;
settings.setValue("transparency_pass_number", 4);
}
viewer->setTotalPass(val);
CGAL::Three::Three::s_defaultSMRM = CGAL::Three::Three::modeFromName( CGAL::Three::Three::s_defaultSMRM = CGAL::Three::Three::modeFromName(
settings.value("default_sm_rm", "flat+edges").toString()); settings.value("default_sm_rm", "flat+edges").toString());
CGAL::Three::Three::s_defaultPSRM = CGAL::Three::Three::modeFromName( CGAL::Three::Three::s_defaultPSRM = CGAL::Three::Three::modeFromName(
@ -3173,9 +3182,9 @@ void SubViewer::lookat()
if (viewer->camera()->frame()->isSpinning()) if (viewer->camera()->frame()->isSpinning())
viewer->camera()->frame()->stopSpinning(); viewer->camera()->frame()->stopSpinning();
mw->viewerShow(viewer, mw->viewerShow(viewer,
(float)dialog.get_x(), (float)dialog.get_x() + viewer->offset().x,
(float)dialog.get_y(), (float)dialog.get_y() + viewer->offset().y,
(float)dialog.get_z()); (float)dialog.get_z() + viewer->offset().z);
} }
} }

View File

@ -91,7 +91,8 @@ public :
//get the references //get the references
this->scene = scene_interface; this->scene = scene_interface;
this->messages = mi; this->messages = mi;
plane = NULL; plane = nullptr;
clipper_item = nullptr;
//creates and link the actions //creates and link the actions
actionClipPolyhedra = new QAction("Clip Polyhedra With Plane", mw); actionClipPolyhedra = new QAction("Clip Polyhedra With Plane", mw);
actionClipPolyhedra->setProperty("subMenuName","Polygon Mesh Processing/Corefinement"); actionClipPolyhedra->setProperty("subMenuName","Polygon Mesh Processing/Corefinement");

View File

@ -905,6 +905,8 @@ bool Scene_edit_polyhedron_item::eventFilter(QObject* /*target*/, QEvent *event)
// check state changes between old and current state // check state changes between old and current state
bool ctrl_pressed_now = d->state.ctrl_pressing && !old_state.ctrl_pressing; bool ctrl_pressed_now = d->state.ctrl_pressing && !old_state.ctrl_pressing;
bool ctrl_released_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) if(ctrl_pressed_now || ctrl_released_now || event->type() == QEvent::HoverMove)
{// activate a handle manipulated frame {// activate a handle manipulated frame
CGAL::QGLViewer* viewer = Three::mainViewer(); CGAL::QGLViewer* viewer = Three::mainViewer();

View File

@ -84,9 +84,12 @@ Scene::addItem(CGAL::Three::Scene_item* item)
addGroup(group); addGroup(group);
//init the item for the mainViewer to avoid using unexisting //init the item for the mainViewer to avoid using unexisting
//VAOs if the mainViewer is not the first to be drawn. //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->draw(CGAL::Three::Three::mainViewer());
item->drawEdges(CGAL::Three::Three::mainViewer()); item->drawEdges(CGAL::Three::Three::mainViewer());
item->drawPoints(CGAL::Three::Three::mainViewer()); item->drawPoints(CGAL::Three::Three::mainViewer());
CGAL::Three::Three::mainViewer()->setDepthPeelingFbo(fbo);
return id; return id;
} }

View File

@ -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): Scene_surface_mesh_item_priv(const Scene_surface_mesh_item& other, Scene_surface_mesh_item* parent):
smesh_(new SMesh(*other.d->smesh_)), smesh_(new SMesh(*other.d->smesh_)),
idx_data_(other.d->idx_data_), 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 = parent;
item->setTriangleContainer(1, new Triangle_container(VI::PROGRAM_WITH_LIGHT, item->setTriangleContainer(1, new Triangle_container(VI::PROGRAM_WITH_LIGHT,