Core/Gui: Render primitives on top of the scene in PickGeometry
+ added some better grouping for items, which are assigned per object right now. For example, if we exceed 10 items per object it gets an additional group. Co-authored-by: realthunder <realthunder@users.noreply.github.com>
This commit is contained in:
@@ -367,20 +367,51 @@ void SoFCUnifiedSelection::doAction(SoAction *action)
|
||||
App::Document* doc = App::GetApplication().getDocument(preselectAction->SelChange.pDocName);
|
||||
App::DocumentObject* obj = doc->getObject(preselectAction->SelChange.pObjectName);
|
||||
ViewProvider*vp = Application::Instance->getViewProvider(obj);
|
||||
SoDetail* detail = vp->getDetail(preselectAction->SelChange.pSubName);
|
||||
|
||||
// use getDetailPath() like selection does, instead of just getDetail()
|
||||
SoDetail* detail = nullptr;
|
||||
detailPath->truncate(0);
|
||||
auto subName = preselectAction->SelChange.pSubName;
|
||||
|
||||
SoFullPath* pathToHighlight = nullptr;
|
||||
if (vp && vp->isDerivedFrom(ViewProviderDocumentObject::getClassTypeId()) &&
|
||||
(useNewSelection.getValue() || vp->useNewSelectionModel()) && vp->isSelectable()) {
|
||||
|
||||
// get proper detail path for sub-objects (like Assembly parts)
|
||||
if (!subName || !subName[0] || vp->getDetailPath(subName, detailPath, true, detail)) {
|
||||
if (detailPath->getLength()) {
|
||||
pathToHighlight = detailPath;
|
||||
} else {
|
||||
// fallback to ViewProvider root if no specific path
|
||||
pathToHighlight = static_cast<SoFullPath*>(new SoPath(2));
|
||||
pathToHighlight->ref();
|
||||
pathToHighlight->append(vp->getRoot());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
detail = vp->getDetail(subName);
|
||||
pathToHighlight = static_cast<SoFullPath*>(new SoPath(2));
|
||||
pathToHighlight->ref();
|
||||
pathToHighlight->append(vp->getRoot());
|
||||
}
|
||||
|
||||
SoHighlightElementAction highlightAction;
|
||||
highlightAction.setHighlighted(true);
|
||||
highlightAction.setColor(this->colorHighlight.getValue());
|
||||
highlightAction.setElement(detail);
|
||||
highlightAction.apply(vp->getRoot());
|
||||
if (pathToHighlight) {
|
||||
SoHighlightElementAction highlightAction;
|
||||
highlightAction.setHighlighted(true);
|
||||
highlightAction.setColor(this->colorHighlight.getValue());
|
||||
highlightAction.setElement(detail);
|
||||
highlightAction.apply(pathToHighlight);
|
||||
|
||||
currentHighlightPath = static_cast<SoFullPath*>(pathToHighlight->copy());
|
||||
currentHighlightPath->ref();
|
||||
|
||||
// clean up temporary path if we created one
|
||||
if (pathToHighlight != detailPath) {
|
||||
pathToHighlight->unref();
|
||||
}
|
||||
}
|
||||
|
||||
delete detail;
|
||||
|
||||
SoSearchAction sa;
|
||||
sa.setNode(vp->getRoot());
|
||||
sa.apply(vp->getRoot());
|
||||
currentHighlightPath = static_cast<SoFullPath*>(sa.getPath()->copy());
|
||||
currentHighlightPath->ref();
|
||||
}
|
||||
|
||||
if (useNewSelection.getValue())
|
||||
|
||||
Reference in New Issue
Block a user