Skip to content

Commit

Permalink
Merge pull request #87 from untereiner/work
Browse files Browse the repository at this point in the history
Work
  • Loading branch information
Lionel Untereiner authored Feb 28, 2019
2 parents 1084a24 + 7713ef3 commit 8ebebbb
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 9 deletions.
15 changes: 14 additions & 1 deletion schnapps/core/view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand Down Expand Up @@ -432,14 +433,22 @@ 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_)
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()
Expand Down Expand Up @@ -491,6 +500,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_)
Expand Down
2 changes: 1 addition & 1 deletion schnapps/core/view.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ private slots:
std::unique_ptr<cgogn::rendering::DisplayListDrawer::Renderer> frame_drawer_renderer_;

bool save_snapshots_;

bool show_bbs_;
bool updating_ui_;
};

Expand Down
2 changes: 1 addition & 1 deletion schnapps/plugins/cmap_provider/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ set_target_properties(${PROJECT_NAME} PROPERTIES
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${CMAKE_BINARY_DIR}>
$<BUILD_INTERFACE:${SCHNAPPS_SOURCE_DIR}>
$<BUILD_INTERFACE:${CGOGN_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)

generate_export_header(plugin_cmap_provider)
Expand Down
23 changes: 17 additions & 6 deletions schnapps/plugins/import/import.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down Expand Up @@ -80,9 +79,18 @@ bool Plugin_Import::enable()

plugin_cmap_provider_ = static_cast<plugin_cmap_provider::Plugin_CMapProvider*>(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()));
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down Expand Up @@ -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())
Expand Down
7 changes: 7 additions & 0 deletions schnapps/plugins/import/import.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8ebebbb

Please sign in to comment.