PartDesign: change SubShapeBinder claim children behavior

This commit is contained in:
Zheng, Lei
2020-03-04 21:02:07 +08:00
committed by wwmayer
parent 709cc591fd
commit 4364efca47
3 changed files with 61 additions and 3 deletions

View File

@@ -343,9 +343,26 @@ void ViewProviderSubShapeBinder::updatePlacement(bool transaction) {
std::vector<App::DocumentObject*> ViewProviderSubShapeBinder::claimChildren(void) const {
std::vector<App::DocumentObject *> ret;
auto self = dynamic_cast<PartDesign::SubShapeBinder*>(getObject());
if(self && self->ClaimChildren.getValue() && self->Support.getValue())
ret.push_back(self->Support.getValue());
auto self = Base::freecad_dynamic_cast<PartDesign::SubShapeBinder>(getObject());
if(self && self->ClaimChildren.getValue() && self->Support.getValue()) {
std::set<App::DocumentObject *> objSet;
for(auto &l : self->Support.getSubListValues()) {
auto obj = l.getValue();
if(!obj)
continue;
const auto &subs = l.getSubValues();
if(subs.empty()) {
if(objSet.insert(obj).second)
ret.push_back(obj);
continue;
}
for(auto &sub : subs) {
auto sobj = obj->getSubObject(sub.c_str());
if(sobj && objSet.insert(sobj).second)
ret.push_back(sobj);
}
}
}
return ret;
}