From 145842bea9cffe04bc4a898a5e0310e0c2da8aa3 Mon Sep 17 00:00:00 2001 From: Lionel Untereiner Date: Tue, 5 Feb 2019 14:47:31 +0100 Subject: [PATCH 1/4] [core] ADD (un)show bboxes of a view --- schnapps/core/view.cpp | 6 ++++++ schnapps/core/view.h | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/schnapps/core/view.cpp b/schnapps/core/view.cpp index e85e987..561f694 100644 --- a/schnapps/core/view.cpp +++ b/schnapps/core/view.cpp @@ -61,6 +61,7 @@ View::View(const QString& name, SCHNApps* s) : frame_drawer_(nullptr), frame_drawer_renderer_(nullptr), save_snapshots_(false), + show_bbs_(true), updating_ui_(false) { ++view_count_; @@ -432,6 +433,7 @@ void View::draw() QMatrix4x4 o_mm = mm * o->frame_matrix() * o->transformation_matrix(); // if (o->show_bb()) + if(show_bbs_) o->draw_bb(this, pm, o_mm); for (PluginInteraction* plugin : plugins_) @@ -491,6 +493,10 @@ void View::keyPressEvent(QKeyEvent* event) schnapps_->cycle_selected_view(); break; + case Qt::Key_B: + show_bbs_ = !show_bbs_; + break; + case Qt::Key_F: { save_snapshots_ = !save_snapshots_; if (save_snapshots_) diff --git a/schnapps/core/view.h b/schnapps/core/view.h index 20576b0..78b3920 100644 --- a/schnapps/core/view.h +++ b/schnapps/core/view.h @@ -292,7 +292,7 @@ private slots: std::unique_ptr frame_drawer_renderer_; bool save_snapshots_; - + bool show_bbs_; bool updating_ui_; }; From 611185bbb858a3e3b002611b9ca05f2291cf423b Mon Sep 17 00:00:00 2001 From: Lionel Untereiner Date: Wed, 27 Feb 2019 21:50:42 +0100 Subject: [PATCH 2/4] [core] FIX ensure that the transparency plugin is the last to draw --- schnapps/core/view.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/schnapps/core/view.cpp b/schnapps/core/view.cpp index 561f694..51af513 100644 --- a/schnapps/core/view.cpp +++ b/schnapps/core/view.cpp @@ -440,8 +440,15 @@ void View::draw() plugin->draw_object(this, o, pm, o_mm); } + PluginInteraction* tr_charged = nullptr; for (PluginInteraction* plugin : plugins_) - plugin->draw(this, pm, mm); + if(plugin->name() != QString("render_transparency")) + plugin->draw(this, pm, mm); + else + tr_charged = plugin; + + if(tr_charged != nullptr) + tr_charged->draw(this, pm, mm); } void View::postDraw() From 7eca9d62dc55bbdb036baf91a914527b8127cf84 Mon Sep 17 00:00:00 2001 From: Lionel Untereiner Date: Wed, 27 Feb 2019 21:51:08 +0100 Subject: [PATCH 3/4] [core] FIX include directories --- schnapps/plugins/cmap_provider/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schnapps/plugins/cmap_provider/CMakeLists.txt b/schnapps/plugins/cmap_provider/CMakeLists.txt index 14ed5be..734a1d8 100644 --- a/schnapps/plugins/cmap_provider/CMakeLists.txt +++ b/schnapps/plugins/cmap_provider/CMakeLists.txt @@ -48,7 +48,7 @@ set_target_properties(${PROJECT_NAME} PROPERTIES target_include_directories(${PROJECT_NAME} PUBLIC $ $ - $ + $ ) generate_export_header(plugin_cmap_provider) From 7713ef34afe1f64de506d189f2627c29142d436e Mon Sep 17 00:00:00 2001 From: Lionel Untereiner Date: Wed, 27 Feb 2019 21:51:48 +0100 Subject: [PATCH 4/4] [import] ADD filter by file type --- schnapps/plugins/import/import.cpp | 23 +++++++++++++++++------ schnapps/plugins/import/import.h | 7 +++++++ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/schnapps/plugins/import/import.cpp b/schnapps/plugins/import/import.cpp index 76c7414..ce8f90f 100644 --- a/schnapps/plugins/import/import.cpp +++ b/schnapps/plugins/import/import.cpp @@ -50,7 +50,6 @@ QString Plugin_Import::plugin_name() bool Plugin_Import::enable() { - //schnapps_->add_menu("Import"); import_point_set_action_ = schnapps_->add_menu_action("Import;Point Set", "import point set"); import_polyline_action_ = schnapps_->add_menu_action("Import;Polyline", "import polyline"); import_graph_action_ = schnapps_->add_menu_action("Import;Graph", "import graph"); @@ -80,9 +79,18 @@ bool Plugin_Import::enable() plugin_cmap_provider_ = static_cast(schnapps_->enable_plugin(plugin_cmap_provider::Plugin_CMapProvider::plugin_name())); + + point_set_filter_ = QString::fromStdString(cgogn::io::file_type_filter(cgogn::io::point_set_file_type_map, " ")); + polyline_filter_ = QString::fromStdString(cgogn::io::file_type_filter(cgogn::io::polyline_file_type_map, " ")); + graph_filter_ = QString::fromStdString(cgogn::io::file_type_filter(cgogn::io::graph_file_type_map, " ")); + surface_filter_ = QString::fromStdString(cgogn::io::file_type_filter(cgogn::io::surface_file_type_map, " ")); + volume_filter_ = QString::fromStdString(cgogn::io::file_type_filter(cgogn::io::volume_file_type_map, " ")); + return true; } + + void Plugin_Import::disable() { disconnect(import_point_set_action_, SIGNAL(triggered()), this, SLOT(import_point_set_from_file_dialog())); @@ -136,7 +144,7 @@ CMap0Handler* Plugin_Import::import_point_set_from_file(const QString& filename) void Plugin_Import::import_point_set_from_file_dialog() { - QStringList filenames = QFileDialog::getOpenFileNames(nullptr, "Import point sets", setting_default_path_, "Point set Files (*.plo)"); + QStringList filenames = QFileDialog::getOpenFileNames(nullptr, "Import point sets", setting_default_path_, "Point set Files ("+point_set_filter_+")"); QStringList::Iterator it = filenames.begin(); if (it != filenames.end()) @@ -190,7 +198,7 @@ CMap1Handler* Plugin_Import::import_polyline_from_file(const QString& filename) void Plugin_Import::import_polyline_from_file_dialog() { - QStringList filenames = QFileDialog::getOpenFileNames(nullptr, "Import polyline meshes", setting_default_path_, "Polyline mesh Files (*.lin *.off)"); + QStringList filenames = QFileDialog::getOpenFileNames(nullptr, "Import polyline meshes", setting_default_path_, "Polyline mesh Files ("+polyline_filter_+")"); QStringList::Iterator it = filenames.begin(); if (it != filenames.end()) @@ -244,7 +252,7 @@ UndirectedGraphHandler* Plugin_Import::import_graph_from_file(const QString& fil void Plugin_Import::import_graph_from_file_dialog() { - QStringList filenames = QFileDialog::getOpenFileNames(nullptr, "Import graph", setting_default_path_, "Graph Files (*.cg *.skel *.cskel *.obj)"); + QStringList filenames = QFileDialog::getOpenFileNames(nullptr, "Import graph", setting_default_path_, "Graph Files ("+graph_filter_+")"); QStringList::Iterator it = filenames.begin(); if (it != filenames.end()) @@ -326,7 +334,10 @@ CMap2Handler* Plugin_Import::import_surface_mesh_from_file(const QString& filena void Plugin_Import::import_surface_mesh_from_file_dialog() { - QStringList filenames = QFileDialog::getOpenFileNames(nullptr, "Import surface meshes", setting_default_path_, "Surface mesh Files (*.ply *.off *.stl *.trian *.vtk *.vtp *.vtu *.obj *.2dm *.msh *.mesh *.meshb)"); + + qDebug() << surface_filter_; + + QStringList filenames = QFileDialog::getOpenFileNames(nullptr, "Import surface meshes", setting_default_path_, "Surface mesh Files ("+surface_filter_+")"); QStringList::Iterator it = filenames.begin(); if (it != filenames.end()) @@ -408,7 +419,7 @@ CMap3Handler* Plugin_Import::import_volume_mesh_from_file(const QString& filenam void Plugin_Import::import_volume_mesh_from_file_dialog() { - QStringList filenames = QFileDialog::getOpenFileNames(nullptr, "Import volume meshes", setting_default_path_, "Volume mesh Files (*.msh *.vtu *.vtk *.nas *.bdf *.ele *.tetmesh *.node *.mesh *.meshb *.tet)"); + QStringList filenames = QFileDialog::getOpenFileNames(nullptr, "Import volume meshes", setting_default_path_, "Volume mesh Files ("+volume_filter_+")"); QStringList::Iterator it = filenames.begin(); if (it != filenames.end()) diff --git a/schnapps/plugins/import/import.h b/schnapps/plugins/import/import.h index b637db9..1fdf2d9 100644 --- a/schnapps/plugins/import/import.h +++ b/schnapps/plugins/import/import.h @@ -101,6 +101,13 @@ private slots: QAction* import_graph_action_; QAction* import_surface_mesh_action_; QAction* import_volume_mesh_action_; + + QString point_set_filter_; + QString polyline_filter_; + QString graph_filter_; + QString surface_filter_; + QString volume_filter_; + }; } // namespace plugin_import