]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #3161: Do not use presentations for non-SHAPER objects
authorvsv <vsv@opencascade.com>
Fri, 28 Feb 2020 12:55:45 +0000 (15:55 +0300)
committervsv <vsv@opencascade.com>
Fri, 28 Feb 2020 12:55:45 +0000 (15:55 +0300)
src/PartSet/PartSet_Filters.cpp

index 88ba16c9ad36518e8722fbb5326eea378693d354..2cb28142242900daf88ebed6f581f983f9a09024 100644 (file)
@@ -47,21 +47,26 @@ PartSet_GlobalFilter::PartSet_GlobalFilter(ModuleBase_IWorkshop* theWorkshop)
 Standard_Boolean PartSet_GlobalFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
 {
   bool aValid = true;
+  std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject());
+  Handle(AIS_InteractiveObject) aAisObj;
+  if (theOwner->HasSelectable()) {
+    aAisObj = Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
+    if (!aAisObj.IsNull()) {
+      aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aAisObj));
+    }
+  }
+  ObjectPtr aObj = myWorkshop->findPresentedObject(aAISObj);
   ModuleBase_Operation* anOperation = myWorkshop->module()->currentOperation();
+
+  // Issue #3161: Do not use presentations for non-SHAPER objects
+  if (!anOperation && !aObj.get())
+    return false;
+
   // the shapes from different documents should be provided if there is no started operation
   // in order to show/hide results
   if (anOperation) {
     aValid = false;
     if (ModuleBase_ShapeDocumentFilter::IsOk(theOwner)) {
-      std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject());
-      if (theOwner->HasSelectable()) {
-        Handle(AIS_InteractiveObject) aAisObj =
-          Handle(AIS_InteractiveObject)::DownCast(theOwner->Selectable());
-        if (!aAisObj.IsNull()) {
-          aAISObj->setImpl(new Handle(AIS_InteractiveObject)(aAisObj));
-        }
-      }
-      ObjectPtr aObj = myWorkshop->findPresentedObject(aAISObj);
       if (aObj) {
         ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
         // result of parts belongs to PartSet document and can be selected only when PartSet