| 508 | } |
| 509 | |
| 510 | SoNode* ViewProviderDocumentObject::findFrontRootOfType(const SoType& type) const |
| 511 | { |
| 512 | if (!pcObject) { |
| 513 | return nullptr; |
| 514 | } |
| 515 | // first get the document this object is part of and get its GUI counterpart |
| 516 | App::Document* pAppDoc = pcObject->getDocument(); |
| 517 | Gui::Document* pGuiDoc = Gui::Application::Instance->getDocument(pAppDoc); |
| 518 | |
| 519 | SoSearchAction searchAction; |
| 520 | searchAction.setType(type); |
| 521 | searchAction.setInterest(SoSearchAction::FIRST); |
| 522 | |
| 523 | // search in all view providers for the node type |
| 524 | std::vector<App::DocumentObject*> obj = pAppDoc->getObjects(); |
| 525 | for (auto& it : obj) { |
| 526 | const ViewProvider* vp = pGuiDoc->getViewProvider(it); |
| 527 | // Ignore 'this' view provider. It could also happen that vp is 0, e.g. when |
| 528 | // several objects have been added to the App::Document before notifying the |
| 529 | // Gui::Document |
| 530 | if (!vp || vp == this) { |
| 531 | continue; |
| 532 | } |
| 533 | SoSeparator* front = vp->getFrontRoot(); |
| 534 | // if (front && front->getTypeId() == type) |
| 535 | // return front; |
| 536 | if (front) { |
| 537 | searchAction.apply(front); |
| 538 | SoPath* path = searchAction.getPath(); |
| 539 | if (path) { |
| 540 | return path->getTail(); |
| 541 | } |
| 542 | } |
| 543 | } |
| 544 | |
| 545 | return nullptr; |
| 546 | } |
| 547 | |
| 548 | void ViewProviderDocumentObject::setActiveMode() |
| 549 | { |
nothing calls this directly
no test coverage detected