Salome HOME
Allow to select faces features as a common argument (in the frames of issue #2563)
authormpv <mpv@opencascade.com>
Mon, 10 Sep 2018 13:50:51 +0000 (16:50 +0300)
committermpv <mpv@opencascade.com>
Mon, 10 Sep 2018 13:51:13 +0000 (16:51 +0300)
src/FeaturesPlugin/FeaturesPlugin_Validators.cpp

index 3201919963d87895b72c3d660af34fdc5061022d..e28008720d77cdd77dfd50a16a017ec601163cda 100644 (file)
@@ -1592,7 +1592,7 @@ bool FeaturesPlugin_ValidatorBooleanCommonSelection::isValid(
       return false;
     }
     ResultPtr aContext = anAttrSelection->context();
-    if (!aContext.get()) {
+    if (!aContext.get() && !anAttrSelection->contextFeature().get()) {
       theError = "Error: Empty selection context.";
       return false;
     }
@@ -1605,15 +1605,16 @@ bool FeaturesPlugin_ValidatorBooleanCommonSelection::isValid(
       }
     }
     std::shared_ptr<GeomAPI_Shape> aShape = anAttrSelection->value();
-    GeomShapePtr aContextShape = aContext->shape();
-    if (!aShape.get()) {
+    GeomShapePtr aContextShape;
+    if (!aShape.get() && aContext.get()) {
+      aContextShape = aContext->shape();
       aShape = aContextShape;
     }
     if (!aShape.get()) {
       theError = "Error: Empty shape.";
       return false;
     }
-    if (!aShape->isEqual(aContextShape)) {
+    if (aContextShape.get() && !aShape->isEqual(aContextShape)) {
       theError = "Error: Local selection not allowed.";
       return false;
     }