Merge pull request #19917 from tritao/refactor-document-recompute

Core: Refactor code around document and feature recompute
This commit is contained in:
Chris Hennes
2025-03-16 23:59:12 -05:00
committed by GitHub
13 changed files with 73 additions and 79 deletions

View File

@@ -3370,7 +3370,7 @@ int Document::_recomputeFeature(DocumentObject* Feat)
return 1;
}
catch (std::exception& e) {
FC_ERR("exception in " << Feat->getFullName() << " thrown: " << e.what());
FC_ERR("Exception in " << Feat->getFullName() << " thrown: " << e.what());
d->addRecomputeLog(e.what(), Feat);
return 1;
}
@@ -3394,26 +3394,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();
}
}