Salome HOME
updated copyright message
[modules/shaper.git] / src / Model / Model_Update.cpp
index 9127a9915cab6da6e7d1306a10cfc62007505ade..2100f48b902b1210a53f7565de78ca08cac6a770 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2020  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -346,18 +346,6 @@ void Model_Update::processEvent(const std::shared_ptr<Events_Message>& theMessag
       if (anUpdated.get()) {
         if (addModified(anUpdated, FeaturePtr()))
           aSomeModified = true;
-        if (myUpdateBlocked) { // execute this feature anyway to show the current result
-          /*if (!anUpdated->isStable() && anUpdated->results().size() && (
-              anUpdated->firstResult()->groupName() == ModelAPI_ResultBody::group() ||
-              anUpdated->firstResult()->groupName() == ModelAPI_ResultPart::group())) {
-            if (aFactory->validate(anUpdated)) {
-              executeFeature(anUpdated);
-              redisplayWithResults(anUpdated, ModelAPI_StateNothing, false);
-              static Events_ID EVENT_DISP = aLoop->eventByName(EVENT_OBJECT_TO_REDISPLAY);
-              aLoop->flush(EVENT_DISP);
-            }
-          }*/
-        }
       } else {
         // process the updated result as update of features that refers to this result
         const std::set<std::shared_ptr<ModelAPI_Attribute> >&
@@ -735,7 +723,8 @@ bool Model_Update::processFeature(FeaturePtr theFeature)
     if (!isPostponedMain) {
       bool aDoExecute = true;
       if (myUpdateBlocked) {
-        if (!theFeature->isStable()) {
+        if (!theFeature->isStable() || (theFeature->getKind().size() > 6 &&
+            theFeature->getKind().substr(0, 6) == "Sketch")) { // automatic update sketch elements
           aDoExecute = true;
         } else if (theFeature->results().size()) { // execute only not persistent results features
           aDoExecute = !theFeature->isPersistentResult();
@@ -905,7 +894,9 @@ void Model_Update::updateArguments(FeaturePtr theFeature) {
           bool isObligatory = !aFactory->isNotObligatory(
             theFeature->getKind(), theFeature->data()->id(aSel)) &&
             aFactory->isCase(theFeature, theFeature->data()->id(aSel));
-          if (isObligatory)
+          if (isObligatory ||
+            // #24260 : sketch plane was selected, but selection becomes wrong, make it invalid
+            (theFeature->getKind() == "Sketch" && aSel->id() == "External"))
             aState = ModelAPI_StateInvalidArgument;
         }
       }
@@ -914,8 +905,7 @@ void Model_Update::updateArguments(FeaturePtr theFeature) {
       bool isObligatory = aFactory->isCase(theFeature, theFeature->data()->id(aSel));
       if (isObligatory)
         aState = ModelAPI_StateInvalidArgument;
-    } else if (theFeature->getKind() == "Sketch" && aSel->id() == "External" &&
-               aSel->isInitialized()) {
+    } else if (aSel->isInitialized()) {
       // #19703 : if sketch plane was selected, but after context disappears, it must become invalid
       aSel->update();
       if (aSel->isInvalid()) {