]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for the issue #1091
authormpv <mpv@opencascade.com>
Wed, 18 Nov 2015 06:09:12 +0000 (09:09 +0300)
committermpv <mpv@opencascade.com>
Wed, 18 Nov 2015 06:09:12 +0000 (09:09 +0300)
src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.cpp
src/FeaturesPlugin/FeaturesPlugin_CompositeSketch.h
src/Model/Model_Update.cpp

index f2edb24b4749fcef10426ee92bdd3264ba84cc58..d9ff9ccfce5966c2e27f3d39656674cc71450b70 100644 (file)
@@ -115,7 +115,10 @@ void FeaturesPlugin_CompositeSketch::execute()
   if(!aConstruction.get()) {
     return;
   }
-  selection(SKETCH_SELECTION_ID())->setValue(aSketchRes, std::shared_ptr<GeomAPI_Shape>());
+
+  if (!selection(SKETCH_SELECTION_ID())->isInitialized() || selection(SKETCH_SELECTION_ID())->context() != aSketchRes) {
+    selection(SKETCH_SELECTION_ID())->setValue(aSketchRes, std::shared_ptr<GeomAPI_Shape>());
+  }
   int aSketchFacesNum = aConstruction->facesNum();
   if(aSketchFacesNum == 0) {
     return;
index 806a004cd1770ce2467f592860615a93c939f1b1..422fd9d183ad2cd72d8fe7ba66b2256472366d81 100644 (file)
@@ -27,7 +27,7 @@ class FeaturesPlugin_CompositeSketch : public ModelAPI_CompositeFeature
     return MY_SKETCH_OBJECT_ID;
   }
 
-  /// Attribute name of sketch feature.
+  /// Attribute name of sketch feature selection: needed for naming of the selected sketch.
   inline static const std::string& SKETCH_SELECTION_ID()
   {
     static const std::string MY_SKETCH_SELECTION_ID("sketch_selection");
index e6d83e1970dbeebf619f32df6eb8dd12dc871bf1..5d198d19ac1b78450de74238b73baf2270d27489 100644 (file)
@@ -172,7 +172,8 @@ void Model_Update::processEvent(const std::shared_ptr<Events_Message>& theMessag
     // place where results are cleared)
     myIsParamUpdated = false;
     myUpdated.clear();
-    myModification = 0;
+    // do not erase it since there may be modification increment on start of operation
+    //myModification = 0;
     myWaitForFinish.clear();
   }
 }
@@ -240,6 +241,8 @@ void Model_Update::processOperation(const bool theTotalUpdate, const bool theFin
       isAutomaticChanged = true;
       myIsAutomatic = true;
     }
+    // modifications inside of the iteration will be different from modification that comes outside
+    myModification++;
     // init iteration from the root document
     iterateUpdate(CompositeFeaturePtr());
 
@@ -455,6 +458,9 @@ bool Model_Update::isOlder(std::shared_ptr<ModelAPI_Feature> theFeature,
     std::shared_ptr<ModelAPI_Result> aRes = *aRIter;
     if (!aRes->isDisabled()) {
       std::map<std::shared_ptr<ModelAPI_Object>, int >::iterator anRIter = myUpdated.find(aRes);
+      int aResultID = aRes->data()->updateID();
+      if (aResultID < anArgID)
+        return true;
       if (anRIter == myUpdated.end()) // not updated at all
         return true;
       if (anRIter->second < anAIter->second)