Salome HOME
Fix for the issue #2753 : error when dump/load script
[modules/shaper.git] / src / FeaturesPlugin / FeaturesPlugin_ValidatorTransform.cpp
index 41dd47afb9751f5bb55b8d04786caf88f0460ebb..694915de7ed847a676e92e267d98f8f2a761610d 100755 (executable)
@@ -25,7 +25,6 @@
 #include "ModelAPI_AttributeSelectionList.h"
 #include "ModelAPI_ResultPart.h"
 #include "ModelAPI_ResultBody.h"
-#include "ModelAPI_ResultCompSolid.h"
 #include "ModelAPI_Session.h"
 
 bool FeaturesPlugin_ValidatorTransform::isValid(const AttributePtr& theAttribute,
@@ -52,14 +51,25 @@ bool FeaturesPlugin_ValidatorTransform::isValid(const AttributePtr& theAttribute
     std::shared_ptr<ModelAPI_AttributeSelection> aSelAttribute = aCurSelList->value(i);
     ResultPtr aResult = aSelAttribute->context();
     if (!aResult) {
+      // this could be a whole feature selected
+      FeaturePtr aFeature = aSelAttribute->contextFeature();
+      if (aFeature.get() && aFeature->results().size() > 0) {
+        if (aFeature->firstResult()->groupName() != ModelAPI_ResultBody::group()) {
+          anErrorGroupName = aFeature->firstResult()->groupName();
+          aValid = false;
+          break;
+        }
+        continue;
+      }
       theError = "Invalid selection.";
       return false;
-    } if (isPartSetDocument) // PartSet document: Result Part is valid
+    }
+    if (isPartSetDocument) // PartSet document: Result Part is valid
       aValid = aResult->groupName() == ModelAPI_ResultPart::group();
     else { // Part document: Result CompSolid is valid
       aValid = aResult->groupName() == ModelAPI_ResultBody::group();
       if (aValid) {
-        ResultCompSolidPtr aComp = std::dynamic_pointer_cast<ModelAPI_ResultCompSolid>(aResult);
+        ResultBodyPtr aComp = std::dynamic_pointer_cast<ModelAPI_ResultBody>(aResult);
         aValid = aComp.get() != NULL;
       }
     }