Merge pull request #19917 from tritao/refactor-document-recompute
Core: Refactor code around document and feature recompute
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user