From 6877f111bee20e7043c142c6bea1102701c317f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20M=C3=B6ller?= Date: Wed, 4 Apr 2012 13:28:05 +0000 Subject: [PATCH] infoMesh support for point clouds or other types without faces refs #498 git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@14319 383ad7c9-94d9-4d36-a494-682f7c89f535 --- MeshObjectInfoPlugin.cc | 50 ++++++++++++++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 6 deletions(-) diff --git a/MeshObjectInfoPlugin.cc b/MeshObjectInfoPlugin.cc index a9e339a..e95e1e4 100644 --- a/MeshObjectInfoPlugin.cc +++ b/MeshObjectInfoPlugin.cc @@ -660,11 +660,17 @@ InfoMeshObjectPlugin:: // Only respond on mesh objects if((_type != DATA_TRIANGLE_MESH) && (_type != DATA_POLY_MESH)) return; - ACG::SceneGraph::PickTarget target = ACG::SceneGraph::PICK_FACE; + ACG::SceneGraph::PickTarget target = ACG::SceneGraph::PICK_ANYTHING; - if(info_->pickMode->currentText().contains("PICK_EDGES") ) { + if (info_->isHidden()) + target = ACG::SceneGraph::PICK_ANYTHING; + else + { + //user has selected the pick mode manually + target = ACG::SceneGraph::PICK_FACE; + if (info_->pickMode->currentIndex() == 1 ) target = ACG::SceneGraph::PICK_EDGE; - } else if (info_->pickMode->currentText().contains("PICK_VERTICES")) { + else if (info_->pickMode->currentIndex() == 2 ) target = ACG::SceneGraph::PICK_VERTEX; } @@ -679,13 +685,45 @@ InfoMeshObjectPlugin:: emit log( LOGINFO , object->getObjectinfo() ); if ( object->picked(node_idx) && object->dataType(DATA_TRIANGLE_MESH) ) - printMeshInfo( PluginFunctions::triMesh(object) , object->id(), target_idx, hit_point ); + { + TriMesh* mesh = PluginFunctions::triMesh(object); + + if (info_->isHidden()) + { + //we picked anything so we have to decide, which data we picked + if (mesh->n_faces() != 0) + info_->pickMode->setCurrentIndex(0); + else if (mesh->n_edges() != 0) + info_->pickMode->setCurrentIndex(1); + else + info_->pickMode->setCurrentIndex(2); + } + + printMeshInfo( mesh , object->id(), target_idx, hit_point ); + } if ( object->picked(node_idx) && object->dataType(DATA_POLY_MESH) ) - printMeshInfo( PluginFunctions::polyMesh(object) , object->id(), target_idx, hit_point ); - + { + PolyMesh* mesh = PluginFunctions::polyMesh(object); + + if (info_->isHidden()) + { + //we picked anything so we have to decide, which data we picked + if (mesh->n_faces() != 0) + info_->pickMode->setCurrentIndex(0); + else if (mesh->n_edges() != 0) + info_->pickMode->setCurrentIndex(1); + else + info_->pickMode->setCurrentIndex(2); + } + printMeshInfo( PluginFunctions::polyMesh(object) , object->id(), target_idx, hit_point ); + } } else return; } + else + { + emit log( LOGERR , tr("Unable to pick object.") ); + } } //------------------------------------------------------------------------------ -- GitLab