Gui: fix property view on multiple sub-element selections

This commit is contained in:
Zheng, Lei
2019-09-04 09:16:46 +08:00
committed by wmayer
parent 7782b51e76
commit f9008396df

View File

@@ -335,36 +335,11 @@ void PropertyView::onTimer() {
std::vector<PropInfo> propViewMap;
bool checkLink = true;
ViewProviderDocumentObject *vpLast = 0;
const auto &array = Gui::Selection().getCompleteSelection(false);
for(auto &sel : array) {
if(!sel.pObject) continue;
App::DocumentObject *parent = 0;
App::DocumentObject *ob = sel.pObject->resolve(sel.SubName,&parent);
auto sels = Gui::Selection().getSelectionEx("*");
for(auto &sel : sels) {
App::DocumentObject *ob = sel.getObject();
if(!ob) continue;
// App::Link should be able to handle special case below now, besides, the new
// support of plain group in App::Link breaks because of the code below
#if 0
if(parent) {
auto parentVp = Application::Instance->getViewProvider(parent);
if(parentVp) {
// For special case where the SubName reference can resolve to
// a non-child object (e.g. link array element), the tree view
// will select the parent instead. So we shall show the
// property of the parent as well.
bool found = false;
for(auto child : parentVp->claimChildren()) {
if(ob == child) {
found = true;
break;
}
}
if(!found)
ob = parent;
}
}
#endif
// Do not process an object more than once
if(!objSet.insert(ob).second)
continue;
@@ -491,7 +466,7 @@ void PropertyView::onTimer() {
dataPropsMap.clear();
for (it = propDataMap.begin(); it != propDataMap.end(); ++it) {
if (it->propList.size() == array.size()) {
if (it->propList.size() == sels.size()) {
if(it->propList[0]->testStatus(App::Property::PropDynamic))
dataPropsMap.emplace(it->propName, std::move(it->propList));
else
@@ -505,7 +480,7 @@ void PropertyView::onTimer() {
propertyEditorData->buildUp(std::move(dataProps));
for (it = propViewMap.begin(); it != propViewMap.end(); ++it) {
if (it->propList.size() == array.size())
if (it->propList.size() == sels.size())
viewProps.emplace_back(it->propName, std::move(it->propList));
}