Actually highlight preselected objects upon the selectionchange event, otherwise it only triggers on mousemove event

This commit is contained in:
Dion Moult
2019-02-23 22:27:33 +11:00
committed by Yorik van Havre
parent 7ecc9cfb21
commit 7da48b3307
2 changed files with 18 additions and 1 deletions

View File

@@ -374,6 +374,22 @@ void SoFCUnifiedSelection::doAction(SoAction *action)
currenthighlight->unref();
currenthighlight = 0;
}
} else if (hilaction->SelChange.Type == SelectionChanges::SetPreselect) {
App::Document* doc = App::GetApplication().getDocument(hilaction->SelChange.pDocName);
App::DocumentObject* obj = doc->getObject(hilaction->SelChange.pObjectName);
ViewProvider*vp = Application::Instance->getViewProvider(obj);
SoDetail* detail = vp->getDetail(hilaction->SelChange.pSubName);
SoHighlightElementAction action;
action.setHighlighted(true);
action.setColor(this->colorHighlight.getValue());
action.setElement(detail);
action.apply(vp->getRoot());
delete detail;
SoSearchAction sa;
sa.setNode(vp->getRoot());
sa.apply(vp->getRoot());
currenthighlight = static_cast<SoFullPath*>(sa.getPath()->copy());
currenthighlight->ref();
}
}

View File

@@ -643,7 +643,8 @@ void View3DInventorViewer::OnChange(Gui::SelectionSingleton::SubjectType& rCalle
SoFCSelectionAction cAct(Reason);
cAct.apply(pcViewProviderRoot);
}
else if (Reason.Type == SelectionChanges::RmvPreselect) {
else if (Reason.Type == SelectionChanges::RmvPreselect ||
Reason.Type == SelectionChanges::SetPreselect) {
SoFCHighlightAction cAct(Reason);
cAct.apply(pcViewProviderRoot);
}