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:
@@ -969,7 +969,7 @@ void ViewProviderMesh::clipMeshCallback(void * ud, SoEventCallback * n)
|
||||
if (clPoly.front() != clPoly.back())
|
||||
clPoly.push_back(clPoly.front());
|
||||
|
||||
std::vector<Gui::ViewProvider*> views = view->getDocument()->getViewProvidersOfType(ViewProviderMesh::getClassTypeId());
|
||||
std::vector<Gui::ViewProvider*> views = view->getViewProvidersOfType(ViewProviderMesh::getClassTypeId());
|
||||
if (!views.empty()) {
|
||||
Gui::Application::Instance->activeDocument()->openCommand(QT_TRANSLATE_NOOP("Command", "Cut"));
|
||||
bool commitCommand = false;
|
||||
@@ -1030,7 +1030,7 @@ void ViewProviderMesh::trimMeshCallback(void * ud, SoEventCallback * n)
|
||||
if (clPoly.front() != clPoly.back())
|
||||
clPoly.push_back(clPoly.front());
|
||||
|
||||
std::vector<Gui::ViewProvider*> views = view->getDocument()->getViewProvidersOfType(ViewProviderMesh::getClassTypeId());
|
||||
std::vector<Gui::ViewProvider*> views = view->getViewProvidersOfType(ViewProviderMesh::getClassTypeId());
|
||||
if (!views.empty()) {
|
||||
Gui::Application::Instance->activeDocument()->openCommand(QT_TRANSLATE_NOOP("Command", "Trim"));
|
||||
bool commitCommand = false;
|
||||
@@ -1112,7 +1112,7 @@ void ViewProviderMesh::partMeshCallback(void * ud, SoEventCallback * cb)
|
||||
Gui::Application::Instance->activeDocument()->openCommand(QT_TRANSLATE_NOOP("Command", "Split"));
|
||||
|
||||
try {
|
||||
std::vector<Gui::ViewProvider*> views = view->getDocument()->getViewProvidersOfType(ViewProviderMesh::getClassTypeId());
|
||||
std::vector<Gui::ViewProvider*> views = view->getViewProvidersOfType(ViewProviderMesh::getClassTypeId());
|
||||
for (std::vector<Gui::ViewProvider*>::iterator it = views.begin(); it != views.end(); ++it) {
|
||||
ViewProviderMesh* that = static_cast<ViewProviderMesh*>(*it);
|
||||
if (that->getEditingMode() > -1) {
|
||||
@@ -1176,7 +1176,7 @@ void ViewProviderMesh::segmMeshCallback(void * ud, SoEventCallback * cb)
|
||||
Gui::Application::Instance->activeDocument()->openCommand(QT_TRANSLATE_NOOP("Command", "Segment"));
|
||||
|
||||
try {
|
||||
std::vector<Gui::ViewProvider*> views = view->getDocument()->getViewProvidersOfType(ViewProviderMesh::getClassTypeId());
|
||||
std::vector<Gui::ViewProvider*> views = view->getViewProvidersOfType(ViewProviderMesh::getClassTypeId());
|
||||
for (std::vector<Gui::ViewProvider*>::iterator it = views.begin(); it != views.end(); ++it) {
|
||||
ViewProviderMesh* that = static_cast<ViewProviderMesh*>(*it);
|
||||
if (that->getEditingMode() > -1) {
|
||||
@@ -1241,7 +1241,7 @@ void ViewProviderMesh::selectGLCallback(void * ud, SoEventCallback * n)
|
||||
if (h<0) h = -h;
|
||||
|
||||
std::vector<Gui::ViewProvider*> views;
|
||||
views = view->getDocument()->getViewProvidersOfType(ViewProviderMesh::getClassTypeId());
|
||||
views = view->getViewProvidersOfType(ViewProviderMesh::getClassTypeId());
|
||||
for (std::vector<Gui::ViewProvider*>::iterator it = views.begin(); it != views.end(); ++it) {
|
||||
ViewProviderMesh* that = static_cast<ViewProviderMesh*>(*it);
|
||||
if (that->getEditingMode() > -1) {
|
||||
@@ -1637,7 +1637,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 = view->getDocument()->getViewProviderByPathFromTail(point->getPath());
|
||||
Gui::ViewProvider* vp = view->getViewProviderByPathFromTail(point->getPath());
|
||||
if (!vp || !vp->getTypeId().isDerivedFrom(ViewProviderMesh::getClassTypeId()))
|
||||
return;
|
||||
|
||||
@@ -1711,7 +1711,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 = view->getDocument()->getViewProviderByPathFromTail(point->getPath());
|
||||
Gui::ViewProvider* vp = view->getViewProviderByPathFromTail(point->getPath());
|
||||
if (!vp || !vp->getTypeId().isDerivedFrom(ViewProviderMesh::getClassTypeId()))
|
||||
return;
|
||||
ViewProviderMesh* that = static_cast<ViewProviderMesh*>(vp);
|
||||
@@ -1746,20 +1746,20 @@ void ViewProviderMesh::markPartCallback(void * ud, SoEventCallback * n)
|
||||
view->setSelectionEnabled(true);
|
||||
view->removeEventCallback(SoMouseButtonEvent::getClassTypeId(), markPartCallback,ud);
|
||||
|
||||
std::vector<ViewProvider*> views = view->getDocument()->getViewProvidersOfType(ViewProviderMesh::getClassTypeId());
|
||||
std::vector<ViewProvider*> views = view->getViewProvidersOfType(ViewProviderMesh::getClassTypeId());
|
||||
for (std::vector<ViewProvider*>::iterator it = views.begin(); it != views.end(); ++it) {
|
||||
static_cast<ViewProviderMesh*>(*it)->clearSelection();
|
||||
}
|
||||
}
|
||||
else if (cf == id) {
|
||||
std::vector<ViewProvider*> views = view->getDocument()->getViewProvidersOfType(ViewProviderMesh::getClassTypeId());
|
||||
std::vector<ViewProvider*> views = view->getViewProvidersOfType(ViewProviderMesh::getClassTypeId());
|
||||
for (std::vector<ViewProvider*>::iterator it = views.begin(); it != views.end(); ++it) {
|
||||
static_cast<ViewProviderMesh*>(*it)->clearSelection();
|
||||
}
|
||||
}
|
||||
else if (rm == id) {
|
||||
Gui::Application::Instance->activeDocument()->openCommand(QT_TRANSLATE_NOOP("Command", "Delete"));
|
||||
std::vector<ViewProvider*> views = view->getDocument()->getViewProvidersOfType(ViewProviderMesh::getClassTypeId());
|
||||
std::vector<ViewProvider*> views = view->getViewProvidersOfType(ViewProviderMesh::getClassTypeId());
|
||||
for (std::vector<ViewProvider*>::iterator it = views.begin(); it != views.end(); ++it) {
|
||||
static_cast<ViewProviderMesh*>(*it)->deleteSelection();
|
||||
}
|
||||
@@ -1778,7 +1778,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 = view->getDocument()->getViewProviderByPathFromTail(point->getPath());
|
||||
Gui::ViewProvider* vp = view->getViewProviderByPathFromTail(point->getPath());
|
||||
if (!vp || !vp->getTypeId().isDerivedFrom(ViewProviderMesh::getClassTypeId()))
|
||||
return;
|
||||
ViewProviderMesh* that = static_cast<ViewProviderMesh*>(vp);
|
||||
|
||||
Reference in New Issue
Block a user