make mesh picking working for view providers underneath a Part container

This commit is contained in:
wmayer
2019-11-09 11:16:23 +01:00
parent a31b15217a
commit 67be01f3ac
5 changed files with 9 additions and 9 deletions

View File

@@ -485,7 +485,7 @@ void ViewProviderInspection::inspectCallback(void * ud, SoEventCallback * n)
n->setHandled();
// check if we have picked one a node of the view provider we are insterested in
Gui::ViewProvider* vp = static_cast<Gui::ViewProvider*>(view->getViewProviderByPath(point->getPath()));
Gui::ViewProvider* vp = view->getDocument()->getViewProviderByPathFromTail(point->getPath());
if (vp && vp->getTypeId().isDerivedFrom(ViewProviderInspection::getClassTypeId())) {
ViewProviderInspection* that = static_cast<ViewProviderInspection*>(vp);
QString info = that->inspectDistance(point);
@@ -505,7 +505,7 @@ void ViewProviderInspection::inspectCallback(void * ud, SoEventCallback * n)
const SoPickedPointList& pps = action.getPickedPointList();
for (int i=0; i<pps.getLength(); ++i) {
const SoPickedPoint * point = pps[i];
vp = static_cast<Gui::ViewProvider*>(view->getViewProviderByPath(point->getPath()));
vp = view->getDocument()->getViewProviderByPathFromTail(point->getPath());
if (vp && vp->getTypeId().isDerivedFrom(ViewProviderInspection::getClassTypeId())) {
ViewProviderInspection* that = static_cast<ViewProviderInspection*>(vp);
QString info = that->inspectDistance(point);

View File

@@ -538,7 +538,7 @@ void MeshSelection::pickFaceCallback(void * ud, SoEventCallback * n)
// By specifying the indexed mesh node 'pcFaceSet' we make sure that the picked point is
// really from the mesh we render and not from any other geometry
Gui::ViewProvider* vp = static_cast<Gui::ViewProvider*>(view->getViewProviderByPath(point->getPath()));
Gui::ViewProvider* vp = view->getDocument()->getViewProviderByPathFromTail(point->getPath());
if (!vp || !vp->getTypeId().isDerivedFrom(ViewProviderMesh::getClassTypeId()))
return;
ViewProviderMesh* mesh = static_cast<ViewProviderMesh*>(vp);

View File

@@ -1525,7 +1525,7 @@ void ViewProviderMesh::faceInfoCallback(void * ud, SoEventCallback * n)
// By specifying the indexed mesh node 'pcFaceSet' we make sure that the picked point is
// really from the mesh we render and not from any other geometry
Gui::ViewProvider* vp = static_cast<Gui::ViewProvider*>(view->getViewProviderByPath(point->getPath()));
Gui::ViewProvider* vp = view->getDocument()->getViewProviderByPathFromTail(point->getPath());
if (!vp || !vp->getTypeId().isDerivedFrom(ViewProviderMesh::getClassTypeId()))
return;
@@ -1599,7 +1599,7 @@ void ViewProviderMesh::fillHoleCallback(void * ud, SoEventCallback * n)
// By specifying the indexed mesh node 'pcFaceSet' we make sure that the picked point is
// really from the mesh we render and not from any other geometry
Gui::ViewProvider* vp = static_cast<Gui::ViewProvider*>(view->getViewProviderByPath(point->getPath()));
Gui::ViewProvider* vp = view->getDocument()->getViewProviderByPathFromTail(point->getPath());
if (!vp || !vp->getTypeId().isDerivedFrom(ViewProviderMesh::getClassTypeId()))
return;
ViewProviderMesh* that = static_cast<ViewProviderMesh*>(vp);
@@ -1666,7 +1666,7 @@ void ViewProviderMesh::markPartCallback(void * ud, SoEventCallback * n)
// By specifying the indexed mesh node 'pcFaceSet' we make sure that the picked point is
// really from the mesh we render and not from any other geometry
Gui::ViewProvider* vp = static_cast<Gui::ViewProvider*>(view->getViewProviderByPath(point->getPath()));
Gui::ViewProvider* vp = view->getDocument()->getViewProviderByPathFromTail(point->getPath());
if (!vp || !vp->getTypeId().isDerivedFrom(ViewProviderMesh::getClassTypeId()))
return;
ViewProviderMesh* that = static_cast<ViewProviderMesh*>(vp);

View File

@@ -510,7 +510,7 @@ void ViewProviderMeshCurvature::curvatureInfoCallback(void * ud, SoEventCallback
// By specifying the indexed mesh node 'pcFaceSet' we make sure that the picked point is
// really from the mesh we render and not from any other geometry
Gui::ViewProvider* vp = static_cast<Gui::ViewProvider*>(view->getViewProviderByPath(point->getPath()));
Gui::ViewProvider* vp = view->getDocument()->getViewProviderByPathFromTail(point->getPath());
if (!vp || !vp->getTypeId().isDerivedFrom(ViewProviderMeshCurvature::getClassTypeId()))
return;
ViewProviderMeshCurvature* self = static_cast<ViewProviderMeshCurvature*>(vp);
@@ -545,7 +545,7 @@ void ViewProviderMeshCurvature::curvatureInfoCallback(void * ud, SoEventCallback
// By specifying the indexed mesh node 'pcFaceSet' we make sure that the picked point is
// really from the mesh we render and not from any other geometry
Gui::ViewProvider* vp = static_cast<Gui::ViewProvider*>(view->getViewProviderByPath(point->getPath()));
Gui::ViewProvider* vp = view->getDocument()->getViewProviderByPathFromTail(point->getPath());
if (!vp || !vp->getTypeId().isDerivedFrom(ViewProviderMeshCurvature::getClassTypeId()))
return;
ViewProviderMeshCurvature* that = static_cast<ViewProviderMeshCurvature*>(vp);

View File

@@ -600,7 +600,7 @@ void CurveOnMeshHandler::Private::vertexCallback(void * ud, SoEventCallback * n)
if (pp) {
CurveOnMeshHandler* self = static_cast<CurveOnMeshHandler*>(ud);
if (!self->d_ptr->wireClosed) {
Gui::ViewProvider* vp = static_cast<Gui::ViewProvider*>(view->getViewProviderByPath(pp->getPath()));
Gui::ViewProvider* vp = view->getDocument()->getViewProviderByPathFromTail(pp->getPath());
if (vp && vp->getTypeId().isDerivedFrom(MeshGui::ViewProviderMesh::getClassTypeId())) {
MeshGui::ViewProviderMesh* mesh = static_cast<MeshGui::ViewProviderMesh*>(vp);
const SoDetail* detail = pp->getDetail();