From: mpv Date: Wed, 16 Dec 2015 14:59:20 +0000 (+0300) Subject: For the issue #1051: make the model able to be opened and parameters modifiable witho... X-Git-Tag: V_2.1.0~168 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cf53b99b0e6d1fa98c51b849246055d9ec940c69;p=modules%2Fshaper.git For the issue #1051: make the model able to be opened and parameters modifiable without the hang up to the application in the infinity loop. --- diff --git a/src/SketchSolver/SketchSolver_Group.cpp b/src/SketchSolver/SketchSolver_Group.cpp index 5b242b632..fbd8bf5e0 100644 --- a/src/SketchSolver/SketchSolver_Group.cpp +++ b/src/SketchSolver/SketchSolver_Group.cpp @@ -199,6 +199,13 @@ bool SketchSolver_Group::updateFeature(FeaturePtr theFeature) { if (!checkFeatureValidity(theFeature)) return false; + // the external feature always should keep the up to date values, so, + // refresh from the solver is never needed + std::shared_ptr aSketchFeature = + std::dynamic_pointer_cast(theFeature); + if (aSketchFeature.get() && aSketchFeature->isExternal()) + return false; + myStorage->refresh(true); return myStorage->update(theFeature); } diff --git a/src/SketchSolver/SketchSolver_Manager.cpp b/src/SketchSolver/SketchSolver_Manager.cpp index 442cf15c2..34b2ea040 100644 --- a/src/SketchSolver/SketchSolver_Manager.cpp +++ b/src/SketchSolver/SketchSolver_Manager.cpp @@ -81,6 +81,7 @@ void SketchSolver_Manager::processEvent( { if (myIsComputed) return; + myIsComputed = true; if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED) || theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED) || theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_MOVED)) { @@ -156,6 +157,7 @@ void SketchSolver_Manager::processEvent( myGroups.insert(myGroups.end(), aSeparatedGroups.begin(), aSeparatedGroups.end()); } } + myIsComputed = false; } // ============================================================================ @@ -339,7 +341,7 @@ std::shared_ptr SketchSolver_Manager // ============================================================================ void SketchSolver_Manager::resolveConstraints(const bool theForceUpdate) { - myIsComputed = true; + //myIsComputed = true; bool needToUpdate = false; static Events_ID anUpdateEvent = Events_Loop::eventByName(EVENT_OBJECT_UPDATED); // to avoid redisplay of each segment on update by solver one by one in the viewer @@ -360,7 +362,7 @@ void SketchSolver_Manager::resolveConstraints(const bool theForceUpdate) // Must be before flush because on "Updated" flush the results may be produced // and the creation event is appeared with many new objects. If myIsComputed these // events are missed in processEvents and some elements are not added. - myIsComputed = false; + //myIsComputed = false; if (needToUpdate || theForceUpdate) Events_Loop::loop()->flush(anUpdateEvent); }