App: Refactor with early exit in Document::recomputeFeature.
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user