if an Undo/Redo is performed then do nothing inside the body feature

This commit is contained in:
wmayer
2017-09-21 19:00:26 +02:00
parent 499cb18a00
commit 7d4eafbab0

View File

@@ -430,33 +430,35 @@ void Body::onSettingDocument() {
}
void Body::onChanged (const App::Property* prop) {
if ( prop == &BaseFeature ) {
FeatureBase* bf = nullptr;
auto first = Group.getValues().empty() ? nullptr : Group.getValues().front();
if(BaseFeature.getValue()) {
//setup the FeatureBase if needed
if(!first || !first->isDerivedFrom(FeatureBase::getClassTypeId())) {
bf = static_cast<FeatureBase*>(getDocument()->addObject("PartDesign::FeatureBase", "BaseFeature"));
insertObject(bf, first, false);
if(!Tip.getValue())
Tip.setValue(bf);
if (!this->getDocument()->isPerformingTransaction()) {
if ( prop == &BaseFeature ) {
FeatureBase* bf = nullptr;
auto first = Group.getValues().empty() ? nullptr : Group.getValues().front();
if(BaseFeature.getValue()) {
//setup the FeatureBase if needed
if(!first || !first->isDerivedFrom(FeatureBase::getClassTypeId())) {
bf = static_cast<FeatureBase*>(getDocument()->addObject("PartDesign::FeatureBase", "BaseFeature"));
insertObject(bf, first, false);
if(!Tip.getValue())
Tip.setValue(bf);
}
else
bf = static_cast<FeatureBase*>(first);
}
else
bf = static_cast<FeatureBase*>(first);
if(bf && (bf->BaseFeature.getValue() != BaseFeature.getValue()))
bf->BaseFeature.setValue(BaseFeature.getValue());
}
if(bf && (bf->BaseFeature.getValue() != BaseFeature.getValue()))
bf->BaseFeature.setValue(BaseFeature.getValue());
}
else if( prop == &Group ) {
//if the FeatureBase was deleted we set the BaseFeature link to nullptr
if(BaseFeature.getValue() &&
(Group.getValues().empty() || !Group.getValues().front()->isDerivedFrom(FeatureBase::getClassTypeId()))) {
BaseFeature.setValue(nullptr);
else if( prop == &Group ) {
//if the FeatureBase was deleted we set the BaseFeature link to nullptr
if(BaseFeature.getValue() &&
(Group.getValues().empty() || !Group.getValues().front()->isDerivedFrom(FeatureBase::getClassTypeId()))) {
BaseFeature.setValue(nullptr);
}
}
}