PD: fix out of scope warnings of Clone feature
If the BaseFeature link of the Body of a Clone feature isn't set then do not update it. Forum thread: https://forum.freecad.org/viewtopic.php?p=675644#p675644
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -48,6 +48,9 @@ public:
|
||||
void onChanged(const App::Property* prop) override;
|
||||
App::DocumentObjectExecReturn* execute() override;
|
||||
void onDocumentRestored() override;
|
||||
|
||||
private:
|
||||
void trySetBaseFeatureOfBody();
|
||||
};
|
||||
|
||||
} //namespace PartDesign
|
||||
|
||||
Reference in New Issue
Block a user