App: Refactor with early exit in Document::recomputeFeature.

This commit is contained in:
Joao Matos
2025-02-28 11:56:06 +00:00
parent 9f6810adc8
commit ea8ff59c27

View File

@@ -3391,26 +3391,25 @@ int Document::_recomputeFeature(DocumentObject* Feat)
return 0;
}
bool Document::recomputeFeature(DocumentObject* Feat, bool recursive)
bool Document::recomputeFeature(DocumentObject* feature, bool recursive)
{
// delete recompute log
d->clearRecomputeLog(Feat);
d->clearRecomputeLog(feature);
// verify that the feature is (active) part of the document
if (Feat->isAttachedToDocument()) {
if (recursive) {
bool hasError = false;
recompute({Feat}, true, &hasError);
return !hasError;
}
else {
_recomputeFeature(Feat);
signalRecomputedObject(*Feat);
return Feat->isValid();
}
if (!feature->isAttachedToDocument()) {
return false;
}
if (recursive) {
bool hasError = false;
recompute({feature}, true, &hasError);
return !hasError;
}
else {
return false;
_recomputeFeature(feature);
signalRecomputedObject(*feature);
return feature->isValid();
}
}