From: mpv Date: Wed, 6 Apr 2016 09:38:12 +0000 (+0300) Subject: Fix the problem with import feature "Apply" button enabling problem. And reexecution... X-Git-Tag: V_2.3.0~341 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0aaaa2a34e33a9bcec74739dcfd116bc4e218d64;p=modules%2Fshaper.git Fix the problem with import feature "Apply" button enabling problem. And reexecution of import on open document. --- diff --git a/src/Model/Model_AttributeRefList.h b/src/Model/Model_AttributeRefList.h index 9f3df94af..b3690b227 100644 --- a/src/Model/Model_AttributeRefList.h +++ b/src/Model/Model_AttributeRefList.h @@ -10,6 +10,7 @@ #include "Model.h" #include "ModelAPI_AttributeRefList.h" #include "ModelAPI_Feature.h" +#include "Model_Document.h" #include #include diff --git a/src/Model/Model_Update.cpp b/src/Model/Model_Update.cpp index 38549c395..6e9f446bb 100644 --- a/src/Model/Model_Update.cpp +++ b/src/Model/Model_Update.cpp @@ -62,6 +62,15 @@ Model_Update::Model_Update() void Model_Update::addModified(FeaturePtr theFeature, FeaturePtr theReason) { if (!theFeature->isPreviewNeeded() && !myIsFinish) { myProcessOnFinish.insert(theFeature); +#ifdef DEB_UPDATE + std::cout<<"*** Add process on finish "<name()<data()->execState() == ModelAPI_StateMustBeUpdated) { + theFeature->data()->execState(ModelAPI_StateDone); + static ModelAPI_ValidatorsFactory* aFactory = ModelAPI_Session::get()->validators(); + aFactory->validate(theFeature); // need to be validated to update the "Apply" state if not previewed + } return; } if (myModified.find(theFeature) != myModified.end()) { @@ -154,7 +163,8 @@ void Model_Update::processEvent(const std::shared_ptr& theMessag const std::set& anObjs = aMsg->objects(); std::set::const_iterator anObjIter = anObjs.cbegin(); for(; anObjIter != anObjs.cend(); anObjIter++) { - ModelAPI_EventCreator::get()->sendUpdated(*anObjIter, kUpdatedEvent); + if (std::dynamic_pointer_cast((*anObjIter)->document())->executeFeatures()) + ModelAPI_EventCreator::get()->sendUpdated(*anObjIter, kUpdatedEvent); } return; } @@ -167,6 +177,9 @@ void Model_Update::processEvent(const std::shared_ptr& theMessag for(; anObjIter != anObjs.cend(); anObjIter++) { if (!(*anObjIter)->data()->isValid()) continue; +#ifdef DEB_UPDATE + std::cout<<">>> in event updated "<<(*anObjIter)->data()->name()<groupName() == ModelAPI_ResultParameter::group()) { myIsParamUpdated = true; } @@ -175,7 +188,7 @@ void Model_Update::processEvent(const std::shared_ptr& theMessag !std::dynamic_pointer_cast((*anObjIter)->document())->executeFeatures(); FeaturePtr anUpdated = std::dynamic_pointer_cast(*anObjIter); if (anUpdated.get()) { - if (!anUpdateOnlyNotPersistent || anUpdated->isPersistentResult()) { + if (!anUpdateOnlyNotPersistent || !anUpdated->isPersistentResult()) { addModified(anUpdated, FeaturePtr()); aSomeModified = true; } @@ -186,7 +199,7 @@ void Model_Update::processEvent(const std::shared_ptr& theMessag if (!(*aRefIter)->owner()->data()->isValid()) continue; FeaturePtr anUpdated = std::dynamic_pointer_cast((*aRefIter)->owner()); - if (anUpdated.get() && (!anUpdateOnlyNotPersistent || anUpdated->isPersistentResult())) { + if (anUpdated.get() && (!anUpdateOnlyNotPersistent || !anUpdated->isPersistentResult())) { addModified(anUpdated, FeaturePtr()); aSomeModified = true; } @@ -200,17 +213,18 @@ void Model_Update::processEvent(const std::shared_ptr& theMessag } else if (theMessage->eventID() == kOpFinishEvent || theMessage->eventID() == kOpAbortEvent || theMessage->eventID() == kOpStartEvent) { + if (theMessage->eventID() == kOpFinishEvent) { + myIsFinish = true; + // add features that wait for finish as modified + std::set >::iterator aFeature = myProcessOnFinish.begin(); + for(; aFeature != myProcessOnFinish.end(); aFeature++) + if ((*aFeature)->data()->isValid()) // there may be already removed wait for features + addModified(*aFeature, FeaturePtr()); + myIsFinish = false; + } + myProcessOnFinish.clear(); // processed features must be only on finish, so clear anyway (to avoid reimport on load) + if (!(theMessage->eventID() == kOpStartEvent)) { - if (theMessage->eventID() == kOpFinishEvent) { - myIsFinish = true; - // add features that wait for finish as modified - std::set >::iterator aFeature = myProcessOnFinish.begin(); - for(; aFeature != myProcessOnFinish.end(); aFeature++) - if ((*aFeature)->data()->isValid()) // there may be already removed wait for features - addModified(*aFeature, FeaturePtr()); - myIsFinish = false; - } - myProcessOnFinish.clear(); processFeatures(); } // remove all macros before clearing all created @@ -599,6 +613,8 @@ bool Model_Update::isReason(std::shared_ptr& theFeature, { std::map, std::set > > ::iterator aReasonsIt = myModified.find(theFeature); + if (aReasonsIt == myModified.end()) + return false; // this case only for not-previewed items update state, nothing is changed in args for it if (aReasonsIt->second.find(theFeature) != aReasonsIt->second.end()) return true; // any is reason if it contains itself FeaturePtr aReasFeat = std::dynamic_pointer_cast(theReason);