Gui: Respect parent container selectability in nested selections
This commit is contained in:
@@ -454,25 +454,32 @@ void SoFCUnifiedSelection::doAction(SoAction* action)
|
||||
// selection changes inside the 3d view are handled in handleEvent()
|
||||
App::Document* doc = App::GetApplication().getDocument(selectionAction->SelChange.pDocName);
|
||||
App::DocumentObject* obj = doc->getObject(selectionAction->SelChange.pObjectName);
|
||||
ViewProvider*vp = Application::Instance->getViewProvider(obj);
|
||||
|
||||
// check if the actual subobject being selected is selectable
|
||||
ViewProvider* vp = Application::Instance->getViewProvider(obj);
|
||||
|
||||
// check if the subobject and all its parent containers are selectable
|
||||
bool isSelectable = false;
|
||||
if (vp) {
|
||||
if (selectionAction->SelChange.pSubName && selectionAction->SelChange.pSubName[0]) {
|
||||
if (auto subObj = obj->getSubObject(selectionAction->SelChange.pSubName)) {
|
||||
auto subVp = Application::Instance->getViewProvider(subObj);
|
||||
isSelectable = subVp ? subVp->isSelectable() : false;
|
||||
} else {
|
||||
isSelectable = vp->isSelectable();
|
||||
// get the entire object hierarchy from root to leaf
|
||||
auto objList = obj->getSubObjectList(selectionAction->SelChange.pSubName);
|
||||
|
||||
isSelectable = true;
|
||||
for (auto* checkObj : objList) {
|
||||
if (auto checkVp = Application::Instance->getViewProvider(checkObj)) {
|
||||
if (!checkVp->isSelectable()) {
|
||||
isSelectable = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
isSelectable = vp->isSelectable();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (vp && (useNewSelection.getValue() || vp->useNewSelectionModel()) && isSelectable) {
|
||||
SoDetail *detail = nullptr;
|
||||
SoDetail* detail = nullptr;
|
||||
detailPath->truncate(0);
|
||||
auto subName = selectionAction->SelChange.pSubName;
|
||||
App::ElementNamePair elementName;
|
||||
|
||||
Reference in New Issue
Block a user