Salome HOME
Debug of update of feature that need no preview
[modules/shaper.git] / src / Model / Model_Update.cpp
index 244aa68678f78cc2ad1d0dbaa10869a6fafbfafe..eed45d3041b262b776cccffe54a24bb5d60a96cd 100644 (file)
@@ -310,7 +310,13 @@ void Model_Update::updateFeature(FeaturePtr theFeature)
   }
 
   // only the currently updated features are executed
-  bool aJustUpdated = myUpdated.find(theFeature) != myUpdated.end() && myUpdated[theFeature] == myModification;
+  bool aJustUpdated = myUpdated.find(theFeature) != myUpdated.end();
+  if (aJustUpdated) {
+    // if preview is not needed, the created feature was not updated before, so, myModification is not actual for this
+    if (theFeature->isPreviewNeeded()) {
+      aJustUpdated = myUpdated[theFeature] == myModification;
+    }
+  }
 
   if (myIsAutomatic && theFeature->data()->execState() == ModelAPI_StateMustBeUpdated)
     aJustUpdated = true;
@@ -380,6 +386,23 @@ void Model_Update::redisplayWithResults(FeaturePtr theFeature, const ModelAPI_Ex
       aRes->data()->setUpdateID(theFeature->data()->updateID());
     }
     ModelAPI_EventCreator::get()->sendUpdated(aRes, EVENT_DISP);
+    // iterate sub-bodies of compsolid
+    ResultCompSolidPtr aComp = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(aRes);
+    if (aComp.get()) {
+      int aNumSub = aComp->numberOfSubs();
+      for(int a = 0; a < aNumSub; a++) {
+        ResultPtr aSub = aComp->subResult(a);
+        if (!aSub->isDisabled()) {// update state only for enabled results (Placement Result Part may make the original Part Result as invalid)
+          aSub->data()->execState(theState);
+          if (theState == ModelAPI_StateDone) // feature become "done", so execution changed results
+            myUpdated[aSub] = myModification;
+        }
+        if (theFeature->data()->updateID() > aSub->data()->updateID()) {
+          aSub->data()->setUpdateID(theFeature->data()->updateID());
+        }
+        ModelAPI_EventCreator::get()->sendUpdated(aSub, EVENT_DISP);
+      }
+    }
   }
   // to redisplay "presentable" feature (for ex. distance constraint)
   ModelAPI_EventCreator::get()->sendUpdated(theFeature, EVENT_DISP);