Salome HOME
Copyright update 2021
[modules/shaper.git] / src / ModuleBase / ModuleBase_ViewerFilters.cpp
index 2777049f802ed492c08d8bf78cb0d2affef2252c..6f1e29be2b8173dfcaedfbbe4273320505b0f83a 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2021  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
@@ -20,6 +20,9 @@
 #include "ModuleBase_ViewerFilters.h"
 #include "ModuleBase_IWorkshop.h"
 #include "ModuleBase_IModule.h"
+#include "ModuleBase_Operation.h"
+#include "ModuleBase_IPropertyPanel.h"
+#include "ModuleBase_ModelWidget.h"
 
 #include <ModelAPI_Session.h>
 #include <ModelAPI_Document.h>
@@ -76,8 +79,13 @@ Standard_Boolean ModuleBase_ShapeDocumentFilter::IsOk(
     if (aObj) {
       DocumentPtr aDoc = aObj->document();
       SessionPtr aMgr = ModelAPI_Session::get();
-      // TODO: disable the next line for the ImportResult feature "objects" widget only
-      aValid = (aDoc == aMgr->activeDocument() || aDoc == aMgr->moduleDocument());
+
+      if (anOperation->propertyPanel()) {
+        ModuleBase_ModelWidget* aWidget = anOperation->propertyPanel()->activeWidget();
+        if (aWidget && aWidget->canUseExternalParts())
+          return Standard_True;
+      }
+      return (aDoc == aMgr->activeDocument() || aDoc == aMgr->moduleDocument());
     }
     else {
       // This object is not controlled by the filter
@@ -150,6 +158,8 @@ Standard_Boolean ModuleBase_ShapeInPlaneFilter::IsOk(
                 case Prs3d_DP_ZAxis:
                   aDir = anAxis.Direction();
                   break;
+                default: // [to avoid compilation warning]
+                  break;
                 }
                 gp_Lin aLine(aTrihedron->Component()->Location(), aDir);
                 return aPlane.Contains(aLine, Precision::Confusion(), Precision::Angular());