diff --git a/src/Mod/PartDesign/App/FeatureBase.cpp b/src/Mod/PartDesign/App/FeatureBase.cpp index 06306141f6..d7fc21cb66 100644 --- a/src/Mod/PartDesign/App/FeatureBase.cpp +++ b/src/Mod/PartDesign/App/FeatureBase.cpp @@ -73,18 +73,22 @@ App::DocumentObjectExecReturn* FeatureBase::execute() { return StdReturn; } +void FeatureBase::trySetBaseFeatureOfBody() +{ + if (auto body = getFeatureBody()) { + if (BaseFeature.getValue() + && body->BaseFeature.getValue() + && body->BaseFeature.getValue() != BaseFeature.getValue()) { + body->BaseFeature.setValue(BaseFeature.getValue()); + } + } +} + void FeatureBase::onChanged(const App::Property* prop) { // the BaseFeature property should track the Body BaseFeature and vice-versa if (prop == &BaseFeature) { - - auto body = getFeatureBody(); - if(!body) - return; - - if (BaseFeature.getValue() && body->BaseFeature.getValue() != BaseFeature.getValue()) { - body->BaseFeature.setValue(BaseFeature.getValue()); - } + trySetBaseFeatureOfBody(); } Part::Feature::onChanged(prop); diff --git a/src/Mod/PartDesign/App/FeatureBase.h b/src/Mod/PartDesign/App/FeatureBase.h index 28812af885..4be140d44d 100644 --- a/src/Mod/PartDesign/App/FeatureBase.h +++ b/src/Mod/PartDesign/App/FeatureBase.h @@ -48,6 +48,9 @@ public: void onChanged(const App::Property* prop) override; App::DocumentObjectExecReturn* execute() override; void onDocumentRestored() override; + +private: + void trySetBaseFeatureOfBody(); }; } //namespace PartDesign