fixes 0003410: 0.17 Regression: recompute will make parts lose color and take a longer delay compared to FC0.16

This commit is contained in:
wmayer
2018-10-02 19:03:48 +02:00
parent b97b9f78e7
commit 7bf4c9d96f
10 changed files with 112 additions and 35 deletions

View File

@@ -110,19 +110,65 @@ bool DocumentObject::recomputeFeature()
return isValid();
}
/**
* @brief Set this document object touched.
* Touching a document object does not mean to recompute it, it only means that
* other document objects that link it (i.e. its InList) will be recomputed.
* If it should be forced to recompute a document object then use
* \ref enforceRecompute() instead.
*/
void DocumentObject::touch(void)
{
StatusBits.set(ObjectStatus::Touch);
}
/**
* @brief Check whether the document object is touched or not.
* @return true if document object is touched, false if not.
*/
bool DocumentObject::isTouched() const
{
return ExpressionEngine.isTouched() || StatusBits.test(ObjectStatus::Touch);
}
/**
* @brief Enforces this document object to be recomputed.
* This can be useful to recompute the feature without
* having to change one of its input properties.
*/
void DocumentObject::enforceRecompute(void)
{
StatusBits.set(ObjectStatus::Enforce);
StatusBits.set(ObjectStatus::Touch);
}
/**
* @brief Check whether the document object must be recomputed or not.
* This means that the 'Enforce' flag is set or that \ref mustExecute()
* returns a value > 0.
* @return true if document object must be recomputed, false if not.
*/
bool DocumentObject::mustRecompute(void) const
{
if (StatusBits.test(ObjectStatus::Enforce))
return true;
return mustExecute() > 0;
}
short DocumentObject::mustExecute(void) const
{
if(isTouched())
if (ExpressionEngine.isTouched())
return 1;
//ask all extensions
auto vector = getExtensionsDerivedFromType<App::DocumentObjectExtension>();
for(auto ext : vector) {
if(ext->extensionMustExecute())
if (ext->extensionMustExecute())
return 1;
}
return 0;
}
const char* DocumentObject::getStatusString(void) const
@@ -503,21 +549,6 @@ std::vector<PyObject *> DocumentObject::getPySubObjects(const std::vector<std::s
return std::vector<PyObject *>();
}
void DocumentObject::touch(void)
{
StatusBits.set(ObjectStatus::Touch);
}
/**
* @brief Check whether the document object is touched or not.
* @return true if document object is touched, false if not.
*/
bool DocumentObject::isTouched() const
{
return ExpressionEngine.isTouched() || StatusBits.test(ObjectStatus::Touch);
}
void DocumentObject::Save (Base::Writer &writer) const
{
if (this->getNameInDocument())