Gui: fix View3DInventorViewer's getViewProviderByPath, getViewProviderByPathFromTail, getViewProvidersOfType

The View3DInventorViewer only contains the top-level view providers which caused unexpected behaviour when using the three methods above. Thus, in client code they haven't been used any more.
Now the methods internally invoke the corresponding methods of the document. This allows it in client code to directly call the appropriate methods again (LoD).
This commit is contained in:
wmayer
2022-12-12 16:41:58 +01:00
parent 94787e8afa
commit 787a37be82
8 changed files with 29 additions and 56 deletions

View File

@@ -537,7 +537,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 = view->getDocument()->getViewProviderByPathFromTail(point->getPath());
Gui::ViewProvider* vp = view->getViewProviderByPathFromTail(point->getPath());
if (vp && vp->getTypeId().isDerivedFrom(ViewProviderInspection::getClassTypeId())) {
ViewProviderInspection* that = static_cast<ViewProviderInspection*>(vp);
QString info = that->inspectDistance(point);
@@ -557,7 +557,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 = view->getDocument()->getViewProviderByPathFromTail(point->getPath());
vp = view->getViewProviderByPathFromTail(point->getPath());
if (vp && vp->getTypeId().isDerivedFrom(ViewProviderInspection::getClassTypeId())) {
ViewProviderInspection* self = static_cast<ViewProviderInspection*>(vp);
QString info = self->inspectDistance(point);