diff --git a/MeshObjectInfoPlugin.cc b/MeshObjectInfoPlugin.cc index a9e339a908392fe1449f59db8770600c30831881..e95e1e4de376e707b52634a22a317a9214b1a1e9 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.") ); + } } //------------------------------------------------------------------------------