- if (theFeature->isPreviewNeeded()) {
- if (std::dynamic_pointer_cast<Model_Document>(theFeature->document())->executeFeatures() ||
- !theFeature->isPersistentResult()) {
- if (aFactory->validate(theFeature)) {
- if (myIsAutomatic || !theFeature->isPersistentResult() /* execute quick, not persistent results */
- || (isUpdated(theFeature) &&
- (theFeature == theFeature->document()->currentFeature(false) ||
- theFeature->document()->currentFeature(false)->isMacro()))) // currently edited
- {
- if (aState == ModelAPI_StateDone || aState == ModelAPI_StateMustBeUpdated) {
- executeFeature(theFeature);
- }
- } else { // must be updatet, but not updated yet
- theFeature->data()->execState(ModelAPI_StateMustBeUpdated);
- const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = theFeature->results();
- std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
- for (; aRIter != aResults.cend(); aRIter++) {
- std::shared_ptr<ModelAPI_Result> aRes = *aRIter;
- aRes->data()->execState(ModelAPI_StateMustBeUpdated);
+ if (theFeature->isDisabled()) { // do not execute the disabled feature
+ // the disabled features must be updated after enabling anyway if their arguments were changed
+ if (theFeature->data()->execState() == ModelAPI_StateDone &&
+ aState == ModelAPI_StateMustBeUpdated)
+ theFeature->data()->execState(ModelAPI_StateMustBeUpdated);
+ } else {
+ if (theFeature->isPreviewNeeded()) {
+ if (std::dynamic_pointer_cast<Model_Document>(theFeature->document())->executeFeatures() ||
+ !theFeature->isPersistentResult()) {
+ if (aFactory->validate(theFeature)) {
+ FeaturePtr aCurrent = theFeature->document()->currentFeature(false);
+ if (myIsAutomatic || !theFeature->isPersistentResult() /* execute quick, not persistent results */
+ || (isUpdated(theFeature) &&
+ (theFeature == aCurrent ||
+ (aCurrent.get() && aCurrent->isMacro())))) // currently edited
+ {
+ if (aState == ModelAPI_StateDone || aState == ModelAPI_StateMustBeUpdated) {
+ executeFeature(theFeature);
+ }
+ } else { // must be updatet, but not updated yet
+ theFeature->data()->execState(ModelAPI_StateMustBeUpdated);
+ const std::list<std::shared_ptr<ModelAPI_Result> >& aResults = theFeature->results();
+ std::list<std::shared_ptr<ModelAPI_Result> >::const_iterator aRIter = aResults.begin();
+ for (; aRIter != aResults.cend(); aRIter++) {
+ std::shared_ptr<ModelAPI_Result> aRes = *aRIter;
+ aRes->data()->execState(ModelAPI_StateMustBeUpdated);
+ }