From 1915774e96a2c2180f3682733a7b6c329bc60fd8 Mon Sep 17 00:00:00 2001 From: mpv Date: Thu, 6 Sep 2018 14:06:32 +0300 Subject: [PATCH] Issue #2612 : Re-calculate model after modification of parameters Correct behavior of auto-update flag on Undo/Redo --- src/Model/Model_Update.cpp | 52 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/src/Model/Model_Update.cpp b/src/Model/Model_Update.cpp index 2bf951ae7..60b2c7206 100755 --- a/src/Model/Model_Update.cpp +++ b/src/Model/Model_Update.cpp @@ -246,6 +246,32 @@ void Model_Update::processEvent(const std::shared_ptr& theMessag #ifdef DEB_UPDATE std::cout<<"****** Event "<eventID().eventText()<isAutoUpdateBlocked(); + if (myUpdateBlocked != aNewAutomaticState) { + myUpdateBlocked = aNewAutomaticState; + if (!myUpdateBlocked) { // process all modified features, even if preview is blocked + bool aPreviewBlockedState = myIsPreviewBlocked; // to update the selected arguments + myIsPreviewBlocked = false; + // iterate everything and add efatures in state "MustBeUpdated" into modified + std::list > allDocs = + ModelAPI_Session::get()->allOpenedDocuments(); + std::list >::iterator aDoc = allDocs.begin(); + for(; aDoc != allDocs.end(); aDoc++) { + std::list > allFeats = (*aDoc)->allFeatures(); + std::list >::iterator aFeat = allFeats.begin(); + for(; aFeat != allFeats.end(); aFeat++) { + if ((*aFeat)->data()->isValid() && + (*aFeat)->data()->execState() == ModelAPI_StateMustBeUpdated) { + addModified(*aFeat, FeaturePtr()); + } + } + } + processFeatures(); + myIsPreviewBlocked = myIsPreviewBlocked; + } + } + if (theMessage->eventID() == kStabilityEvent) { updateStability(theMessage->sender()); return; @@ -265,32 +291,6 @@ void Model_Update::processEvent(const std::shared_ptr& theMessag } return; } - if (theMessage->eventID() == kAutomaticOff) { - myUpdateBlocked = true; - return; - } - if (theMessage->eventID() == kAutomaticOn) { - myUpdateBlocked = false; // then process all modified features, even if preview is blocked - bool aPreviewBlockedState = myIsPreviewBlocked; // to update the selected arguments - myIsPreviewBlocked = false; - // iterate everything and add efatures in state "MustBeUpdated" into modified - std::list > allDocs = - ModelAPI_Session::get()->allOpenedDocuments(); - std::list >::iterator aDoc = allDocs.begin(); - for(; aDoc != allDocs.end(); aDoc++) { - std::list > allFeats = (*aDoc)->allFeatures(); - std::list >::iterator aFeat = allFeats.begin(); - for(; aFeat != allFeats.end(); aFeat++) { - if ((*aFeat)->data()->isValid() && - (*aFeat)->data()->execState() == ModelAPI_StateMustBeUpdated) { - addModified(*aFeat, FeaturePtr()); - } - } - } - processFeatures(); - myIsPreviewBlocked = myIsPreviewBlocked; - return; - } if (theMessage->eventID() == kUpdatedSel) { std::shared_ptr aMsg = std::dynamic_pointer_cast(theMessage); -- 2.39.2