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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,17 +31,18 @@
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
#include <boost/bimap.hpp>
|
||||
#include <boost/graph/adjacency_list.hpp>
|
||||
|
||||
#include <CXX/Objects.hxx>
|
||||
|
||||
#include <App/DocumentObject.h>
|
||||
#include <App/DocumentObserver.h>
|
||||
#include <App/StringHasher.h>
|
||||
#include <Base/UniqueNameManager.h>
|
||||
#include <CXX/Objects.hxx>
|
||||
#include <boost/bimap.hpp>
|
||||
#include <boost/graph/adjacency_list.hpp>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
|
||||
// using VertexProperty = boost::property<boost::vertex_root_t, DocumentObject* >;
|
||||
using DependencyList = boost::adjacency_list<
|
||||
|
||||
Reference in New Issue
Block a user