Salome HOME
IPAL54678: TC-9.5.0: Sub-mesh priority: not all sub-meshes are displayed in the dialog
[modules/smesh.git] / src / SMESHGUI / SMESHGUI.cxx
index 661a7b09ee6e85d027b67b83f66de7678aca1ff6..f638d0391b8722e5ca7be3470c7fdd2a7d138a2b 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2019  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2020  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 
 #include "SMESH_version.h"
 
-#include "SMESH_ControlsDef.hxx"
 #include "SMESH_Actor.h"
 #include "SMESH_ActorUtils.h"
 #include "SMESH_Client.hxx"
+#include "SMESH_Comment.hxx"
+#include "SMESH_ControlsDef.hxx"
 #include "SMESH_ScalarBarActor.h"
-#include <SMESH_Comment.hxx>
 #include "SMESH_TypeFilter.hxx"
 
 // SALOME GUI includes
@@ -1419,9 +1419,16 @@ namespace
                 geomGen = GEOM::GEOM_Gen::_narrow(comp);
               }
             }
-            if (!CORBA::is_nil(geomGen)) {
+            if (!CORBA::is_nil(geomGen))
+            {
               geomGen->BreakLink(aREntry.toStdString().c_str());
               SMESHGUI::GetSMESHGUI()->updateObjBrowser();
+
+              // remove actors whose objects are removed by BreakLink()
+              QList<SUIT_ViewWindow*> wndList = SMESHGUI::desktop()->windows();
+              SUIT_ViewWindow* wnd;
+              foreach(wnd, wndList)
+                SMESH::UpdateActorsAfterUpdateStudy(wnd);
             }
           }
         }
@@ -1429,6 +1436,55 @@ namespace
     }
   }
 
+  //================================================================================
+  /*!
+   * \brief Return true if a mesh icon == ICON_SMESH_TREE_GEOM_MODIF
+   * which means that the mesh can't be modified. It should be either re-computed
+   * or breakShaperLink()'ed. Warn the user about it.
+   */
+  //================================================================================
+
+  bool warnOnGeomModif()
+  {
+    SALOME_ListIO selected;
+    if ( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() )
+      aSel->selectedObjects(selected,"",/*convertReferences=*/false);
+
+    SALOME_ListIteratorOfListIO It( selected );
+    for ( ; It.More(); It.Next() )
+    {
+      Handle(SALOME_InteractiveObject) io = It.Value();
+      if ( !io->hasEntry() ) continue;
+      _PTR(SObject) so = SMESH::getStudy()->FindObjectID( io->getEntry() );
+      SMESH::SMESH_Mesh_var mesh;
+      while ( mesh->_is_nil() && so && so->GetID() != "0:" )
+      {
+        CORBA::Object_var obj = SMESH::SObjectToObject( so );
+        SMESH::SMESH_IDSource_var isrc = SMESH::SMESH_IDSource::_narrow( obj );
+        if ( isrc->_is_nil() )
+          so = so->GetFather();
+        else
+          mesh = isrc->GetMesh();
+      }
+      if ( mesh->_is_nil() ) continue;
+      so = SMESH::FindSObject( mesh );
+      if ( !so ) continue;
+      _PTR(GenericAttribute) attr;
+      so->FindAttribute( attr, "AttributePixMap" );
+      _PTR(AttributePixMap) pixmap = attr;
+      if ( !pixmap ) continue;
+
+      if ( pixmap->GetPixMap() == "ICON_SMESH_TREE_GEOM_MODIF" )
+      {
+        SUIT_MessageBox::warning(SMESHGUI::desktop(),
+                                 QObject::tr("SMESH_WRN_WARNING"),
+                                 QObject::tr("MSG_WARN_ON_GEOM_MODIF"));
+        return true;
+      }
+    }
+    return false;
+  }
+
   void SetDisplayMode(int theCommandID, VTK::MarkerMap& theMarkerMap)
   {
     SALOME_ListIO selected;
@@ -2801,18 +2857,37 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       break;
     }
 
-  case SMESHOp::OpCreateMesh:
-  case SMESHOp::OpCreateSubMesh:
   case SMESHOp::OpEditMeshOrSubMesh:
   case SMESHOp::OpEditMesh:
   case SMESHOp::OpEditSubMesh:
+  case SMESHOp::OpMeshOrder:
+  case SMESHOp::OpCreateSubMesh:
+    if ( warnOnGeomModif() )
+      break; // action forbiden as geometry modified
+
+  case SMESHOp::OpCreateMesh:
   case SMESHOp::OpCompute:
   case SMESHOp::OpComputeSubMesh:
   case SMESHOp::OpPreCompute:
   case SMESHOp::OpEvaluate:
-  case SMESHOp::OpMeshOrder:
+  case SMESHOp::OpShowErrors:
     startOperation( theCommandID );
     break;
+  case SMESHOp::OpRecompute:
+    {
+      if ( isStudyLocked() )
+        break;
+      SALOME_ListIO selected;
+      if ( LightApp_SelectionMgr *sel = selectionMgr() )
+        sel->selectedObjects( selected );
+      if ( selected.Extent() == 1 ) {
+        SMESH::SMESH_Mesh_var aMesh = SMESH::GetMeshByIO( selected.First() );
+        if ( !aMesh->_is_nil() )
+          aMesh->Clear();
+        startOperation( SMESHOp::OpCompute );
+      }
+    }
+    break;
   case SMESHOp::OpCopyMesh:
     {
       if (isStudyLocked()) break;
@@ -2839,6 +2914,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
 
       if ( isStudyLocked() )
         break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
 
       /*Standard_Boolean aRes;
       SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(IObject);
@@ -2869,6 +2946,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
 
       if ( isStudyLocked() )
         break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
 
       EmitSignalDeactivateDialog();
       SMESHGUI_MultiEditDlg* aDlg = NULL;
@@ -2887,6 +2966,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case SMESHOp::OpSmoothing:
     {
       if(isStudyLocked()) break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       if( vtkwnd ) {
         EmitSignalDeactivateDialog();
         ( new SMESHGUI_SmoothingDlg( this ) )->show();
@@ -2899,6 +2980,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case SMESHOp::OpExtrusion:
     {
       if (isStudyLocked()) break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       if (vtkwnd) {
         EmitSignalDeactivateDialog();
         ( new SMESHGUI_ExtrusionDlg ( this ) )->show();
@@ -2910,6 +2993,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case SMESHOp::OpExtrusionAlongAPath:
     {
       if (isStudyLocked()) break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       if (vtkwnd) {
         EmitSignalDeactivateDialog();
         ( new SMESHGUI_ExtrusionAlongPathDlg( this ) )->show();
@@ -2921,6 +3006,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case SMESHOp::OpRevolution:
     {
       if(isStudyLocked()) break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       if( vtkwnd ) {
         EmitSignalDeactivateDialog();
         ( new SMESHGUI_RevolutionDlg( this ) )->show();
@@ -2934,6 +3021,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
     {
       if ( isStudyLocked() )
         break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       if ( vtkwnd )
       {
         EmitSignalDeactivateDialog();
@@ -2950,6 +3039,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case SMESHOp::OpReorientFaces:
   case SMESHOp::OpCreateGeometryGroup:
     {
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       startOperation( theCommandID );
       break;
     }
@@ -2962,6 +3053,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       }
 
       if(isStudyLocked()) break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       EmitSignalDeactivateDialog();
       SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_nil();
 
@@ -2989,6 +3082,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       }
 
       if(isStudyLocked()) break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       EmitSignalDeactivateDialog();
 
       LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
@@ -3066,6 +3161,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
       }
 
       if(isStudyLocked()) break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       EmitSignalDeactivateDialog();
 
       LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
@@ -3163,6 +3260,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
 
       if ( isStudyLocked() )
         break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
 
       EmitSignalDeactivateDialog();
 
@@ -3183,6 +3282,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
     {
       if ( isStudyLocked() )
         break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
 
       EmitSignalDeactivateDialog();
       SMESHGUI_GroupOpDlg* aDlg = new SMESHGUI_DimGroupDlg( this );
@@ -3195,6 +3296,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
     {
       if ( isStudyLocked() )
         break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
 
       EmitSignalDeactivateDialog();
       SMESHGUI_FaceGroupsSeparatedByEdgesDlg* aDlg = new SMESHGUI_FaceGroupsSeparatedByEdgesDlg( this );
@@ -3254,6 +3357,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case SMESHOp::OpEditHypothesis:
     {
       if(isStudyLocked()) break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
 
       LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
       SALOME_ListIO selected;
@@ -3299,6 +3404,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case SMESHOp::OpUnassign:                      // REMOVE HYPOTHESIS / ALGORITHMS
     {
       if(isStudyLocked()) break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       SUIT_OverrideCursor wc;
 
       LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
@@ -3330,6 +3437,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case SMESHOp::OpHexagonalPrism:
     {
       if(isStudyLocked()) break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       if ( vtkwnd ) {
         EmitSignalDeactivateDialog();
         SMDSAbs_EntityType type = SMDSEntity_Edge;
@@ -3356,6 +3465,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case SMESHOp::OpPolyhedron:
     {
       if(isStudyLocked()) break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       if ( vtkwnd ) {
         EmitSignalDeactivateDialog();
         ( new SMESHGUI_CreatePolyhedralVolumeDlg( this ) )->show();
@@ -3379,6 +3490,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case SMESHOp::OpTriQuadraticHexahedron:
     {
       if(isStudyLocked()) break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       if ( vtkwnd ) {
         EmitSignalDeactivateDialog();
         SMDSAbs_EntityType type = SMDSEntity_Last;
@@ -3410,6 +3523,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case SMESHOp::OpRemoveNodes:
     {
       if(isStudyLocked()) break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       if ( vtkwnd ) {
         EmitSignalDeactivateDialog();
         ( new SMESHGUI_RemoveNodesDlg( this ) )->show();
@@ -3423,6 +3538,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case SMESHOp::OpRemoveElements:                                    // REMOVES ELEMENTS
     {
       if(isStudyLocked()) break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       if( vtkwnd ) {
         EmitSignalDeactivateDialog();
         ( new SMESHGUI_RemoveElementsDlg( this ) )->show();
@@ -3437,6 +3554,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case SMESHOp::OpClearMesh: {
 
     if(isStudyLocked()) break;
+    if ( warnOnGeomModif() )
+      break; // action forbiden as geometry modified
 
     SALOME_ListIO selected;
     if( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() )
@@ -3476,6 +3595,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case SMESHOp::OpRemoveOrphanNodes:
     {
       if(isStudyLocked()) break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       SALOME_ListIO selected;
       if( LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr() )
         aSel->selectedObjects( selected );
@@ -3515,6 +3636,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case SMESHOp::OpRenumberingNodes:
     {
       if(isStudyLocked()) break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       if( vtkwnd ) {
         EmitSignalDeactivateDialog();
         ( new SMESHGUI_RenumberingDlg( this, 0 ) )->show();
@@ -3529,6 +3652,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case SMESHOp::OpRenumberingElements:
     {
       if(isStudyLocked()) break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       if ( vtkwnd ) {
         EmitSignalDeactivateDialog();
         ( new SMESHGUI_RenumberingDlg( this, 1 ) )->show();
@@ -3543,6 +3668,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case SMESHOp::OpTranslation:
     {
       if(isStudyLocked()) break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       if ( vtkwnd ) {
         EmitSignalDeactivateDialog();
         ( new SMESHGUI_TranslationDlg( this ) )->show();
@@ -3556,6 +3683,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case SMESHOp::OpRotation:
     {
       if(isStudyLocked()) break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       if( vtkwnd ) {
         EmitSignalDeactivateDialog();
         ( new SMESHGUI_RotationDlg( this ) )->show();
@@ -3569,6 +3698,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case SMESHOp::OpSymmetry:
     {
       if(isStudyLocked()) break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       if(vtkwnd) {
         EmitSignalDeactivateDialog();
         ( new SMESHGUI_SymmetryDlg( this ) )->show();
@@ -3582,6 +3713,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case SMESHOp::OpScale:
     {
       if(isStudyLocked()) break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       if ( vtkwnd ) {
         EmitSignalDeactivateDialog();
         ( new SMESHGUI_ScaleDlg( this ) )->show();
@@ -3596,6 +3729,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case SMESHOp::OpOffset:
     {
       if(isStudyLocked()) break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       if ( vtkwnd ) {
         EmitSignalDeactivateDialog();
         ( new SMESHGUI_OffsetDlg( this ) )->show();
@@ -3610,6 +3745,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case SMESHOp::OpSewing:
     {
       if(isStudyLocked()) break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       if(vtkwnd) {
         EmitSignalDeactivateDialog();
         ( new SMESHGUI_SewingDlg( this ) )->show();
@@ -3623,6 +3760,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case SMESHOp::OpMergeNodes:
     {
       if(isStudyLocked()) break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       if(vtkwnd) {
         EmitSignalDeactivateDialog();
         ( new SMESHGUI_MergeDlg( this, 0 ) )->show();
@@ -3636,6 +3775,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
   case SMESHOp::OpMergeElements:
     {
       if (isStudyLocked()) break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       if (vtkwnd) {
         EmitSignalDeactivateDialog();
         ( new SMESHGUI_MergeDlg( this, 1 ) )->show();
@@ -3647,12 +3788,16 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
     }
 
   case SMESHOp::OpMoveNode: // MAKE MESH PASS THROUGH POINT
+    if ( warnOnGeomModif() )
+      break; // action forbiden as geometry modified
     startOperation( SMESHOp::OpMoveNode );
     break;
 
   case SMESHOp::OpDuplicateNodes:
     {
       if(isStudyLocked()) break;
+      if ( warnOnGeomModif() )
+        break; // action forbiden as geometry modified
       if ( vtkwnd ) {
         EmitSignalDeactivateDialog();
         ( new SMESHGUI_DuplicateNodesDlg( this ) )->show();
@@ -3665,6 +3810,8 @@ bool SMESHGUI::OnGUIEvent( int theCommandID )
     }
 
   case SMESHOp::OpElem0DOnElemNodes: // 0D_ON_ALL_NODES
+    if ( warnOnGeomModif() )
+      break; // action forbiden as geometry modified
     startOperation( SMESHOp::OpElem0DOnElemNodes );
     break;
 
@@ -3867,7 +4014,7 @@ void SMESHGUI::createSMESHAction( const int id, const QString& po_id, const QStr
   if ( !icon_id.isEmpty() )
     pix = resMgr->loadPixmap( "SMESH", tr( icon_id.toLatin1().data() ) );
   else
-    pix = resMgr->loadPixmap( "SMESH", tr( QString( "ICO_%1" ).arg( po_id ).toLatin1().data() ), false );
+    pix = resMgr->loadPixmap( "SMESH", tr( QString( "ICON_%1" ).arg( po_id ).toLatin1().data() ), false );
   if ( !pix.isNull() )
     icon = QIcon( pix );
 
@@ -3974,7 +4121,9 @@ void SMESHGUI::initialize( CAM_Application* app )
   createSMESHAction( SMESHOp::OpCopyMesh,             "COPY_MESH",               "ICON_COPY_MESH" );
   createSMESHAction( SMESHOp::OpCompute,              "COMPUTE",                 "ICON_COMPUTE" );
   createSMESHAction( SMESHOp::OpComputeSubMesh,       "COMPUTE_SUBMESH",         "ICON_COMPUTE" );
+  createSMESHAction( SMESHOp::OpRecompute,            "RE_COMPUTE",              "ICON_COMPUTE" );
   createSMESHAction( SMESHOp::OpPreCompute,           "PRECOMPUTE",              "ICON_PRECOMPUTE" );
+  createSMESHAction( SMESHOp::OpShowErrors,           "SHOW_ERRORS",             "ICON_SHOW_ERRORS" );
   createSMESHAction( SMESHOp::OpEvaluate,             "EVALUATE",                "ICON_EVALUATE" );
   createSMESHAction( SMESHOp::OpMeshOrder,            "MESH_ORDER",              "ICON_MESH_ORDER");
   createSMESHAction( SMESHOp::OpCreateGroup,          "CREATE_GROUP",            "ICON_CREATE_GROUP" );
@@ -4528,20 +4677,22 @@ void SMESHGUI::initialize( CAM_Application* app )
     hasVolumes("({'Volume'} in elemTypes)"),
     hasFacesOrVolumes("(({'Face'} in elemTypes) || ({'Volume'} in elemTypes)) ");
 
-  createPopupItem( SMESHOp::OpFileInformation,   OB, mesh, "&& selcount=1 && isImported" );
-  createPopupItem( SMESHOp::OpCreateSubMesh,     OB, mesh, "&& hasGeomReference");
   createPopupItem( SMESHOp::OpEditMesh,          OB, mesh, "&& selcount=1" );
+  createPopupItem( SMESHOp::OpCreateSubMesh,     OB, mesh, "&& hasGeomReference");
+  createPopupItem( SMESHOp::OpMeshOrder,         OB, mesh, "&& selcount=1 && hasAlgo && hasGeomReference" );
   createPopupItem( SMESHOp::OpEditSubMesh,       OB, subMesh, "&& selcount=1 && hasGeomReference" );
   createPopupItem( SMESHOp::OpEditGroup,         OB, group );
   createPopupItem( SMESHOp::OpEditGeomGroupAsGroup, OB, group, "&& groupType != 'Group'" );
 
   popupMgr()->insert( separator(), -1, 0 );
-  createPopupItem( SMESHOp::OpCompute,           OB, mesh, "&& selcount=1 && isComputable" );
-  createPopupItem( SMESHOp::OpComputeSubMesh,    OB, subMesh, "&& selcount=1 && isComputable" );
-  createPopupItem( SMESHOp::OpPreCompute,        OB, mesh, "&& selcount=1 && isPreComputable" );
-  createPopupItem( SMESHOp::OpEvaluate,          OB, mesh, "&& selcount=1 && isComputable" );
-  createPopupItem( SMESHOp::OpMeshOrder,         OB, mesh, "&& selcount=1 && isComputable && hasGeomReference" );
-  createPopupItem( SMESHOp::OpUpdate,            OB, mesh_part );
+  createPopupItem( SMESHOp::OpCompute,           OB, mesh, "&& selcount=1 && hasAlgo && isComputable" );
+  createPopupItem( SMESHOp::OpRecompute,         OB, mesh, "&& selcount=1 && hasAlgo && " + isNotEmpty );
+  createPopupItem( SMESHOp::OpShowErrors,        OB, mesh, "&& selcount=1 && hasErrors" );
+  createPopupItem( SMESHOp::OpComputeSubMesh,    OB, subMesh, "&& selcount=1 && hasAlgo && isComputable" );
+  createPopupItem( SMESHOp::OpPreCompute,        OB, mesh, "&& selcount=1 && hasAlgo && isPreComputable" );
+  createPopupItem( SMESHOp::OpEvaluate,          OB, mesh, "&& selcount=1 && hasAlgo && isComputable" );
+  popupMgr()->insert( separator(), -1, 0 );
+  createPopupItem( SMESHOp::OpFileInformation,   OB, mesh, "&& selcount=1 && isImported" );
   createPopupItem( SMESHOp::OpMeshInformation,   OB, mesh_part );
   createPopupItem( SMESHOp::OpFindElementByPoint,OB, mesh_group, "&& selcount=1" );
   createPopupItem( SMESHOp::OpOverallMeshQuality,OB, mesh_part );
@@ -4555,8 +4706,8 @@ void SMESHGUI::initialize( CAM_Application* app )
   popupMgr()->insert( separator(), -1, 0 );
   createPopupItem( SMESHOp::OpConvertMeshToQuadratic, OB, mesh_submesh );
   createPopupItem( SMESHOp::OpCreateBoundaryElements, OB, mesh_group, "&& selcount=1 && dim>=2");
-  popupMgr()->insert( separator(), -1, 0 );
-  createPopupItem( SMESHOp::OpClearMesh,              OB, mesh );
+  //popupMgr()->insert( separator(), -1, 0 );
+
   //popupMgr()->insert( separator(), -1, 0 );
 
   QString only_one_non_empty = QString( " && %1=1 && numberOfNodes>0" ).arg( dc );
@@ -4564,6 +4715,7 @@ void SMESHGUI::initialize( CAM_Application* app )
   QString only_one_2D        = only_one_non_empty + " && dim>1";
 
   int anId = popupMgr()->insert( tr( "MEN_EXPORT" ), -1, -1 );        // EXPORT submenu
+  popupMgr()->findMenu( anId )->menuAction()->setIcon( resourceMgr()->loadPixmap( "SMESH", tr( "ICON_EXPORT" )));
   createPopupItem( SMESHOp::OpPopupExportMED,  OB, mesh_group, multiple_non_empty, anId );
   createPopupItem( SMESHOp::OpPopupExportUNV,  OB, mesh_group, only_one_non_empty, anId );
   createPopupItem( SMESHOp::OpPopupExportSTL,  OB, mesh_group, only_one_2D, anId );
@@ -4573,8 +4725,6 @@ void SMESHGUI::initialize( CAM_Application* app )
   createPopupItem( SMESHOp::OpPopupExportSAUV, OB, mesh_group, only_one_non_empty, anId );
   createPopupItem( SMESHOp::OpPopupExportGMF,  OB, mesh_group, only_one_non_empty, anId );
   createPopupItem( SMESHOp::OpPopupExportDAT,  OB, mesh_group, only_one_non_empty, anId );
-  createPopupItem( SMESHOp::OpDelete,          OB, mesh_part + " " + hyp_alg );
-  createPopupItem( SMESHOp::OpDeleteGroup,     OB, group );
 
   anId = popupMgr()->insert( tr( "MEN_IMPORT" ), -1, -1 );        // IMPORT submenu
   createPopupItem( SMESHOp::OpPopupImportMED,  OB, smesh, "", anId );
@@ -4588,18 +4738,22 @@ void SMESHGUI::initialize( CAM_Application* app )
   createPopupItem( SMESHOp::OpPopupImportDAT,  OB, smesh, "", anId );
   popupMgr()->insert( separator(), -1, 0 );
 
+  createPopupItem( SMESHOp::OpClearMesh,         OB, mesh );
+  createPopupItem( SMESHOp::OpDelete,            OB, mesh_part + " " + hyp_alg );
+  createPopupItem( SMESHOp::OpDeleteGroup,       OB, group );
+
   // popup for viewer
   createPopupItem( SMESHOp::OpEditGroup,            View, group );
   createPopupItem( SMESHOp::OpAddElemGroupPopup,    View, elems, "&& guiState = 800" );
   createPopupItem( SMESHOp::OpRemoveElemGroupPopup, View, elems, "&& guiState = 800" );
 
   popupMgr()->insert( separator(), -1, 0 );
-  createPopupItem( SMESHOp::OpUpdate,             View, mesh_part );
   createPopupItem( SMESHOp::OpMeshInformation,    View, mesh_part );
   createPopupItem( SMESHOp::OpOverallMeshQuality, View, mesh_part );
   createPopupItem( SMESHOp::OpFindElementByPoint, View, mesh );
   popupMgr()->insert( separator(), -1, 0 );
 
+  createPopupItem( SMESHOp::OpUpdate,           OB + " " + View, mesh_part );
   createPopupItem( SMESHOp::OpAutoColor,        OB + " " + View, mesh, "&& (not isAutoColor)" );
   createPopupItem( SMESHOp::OpDisableAutoColor, OB + " " + View, mesh, "&& isAutoColor" );
   popupMgr()->insert( separator(), -1, 0 );
@@ -4937,8 +5091,9 @@ bool SMESHGUI::isSelectionCompatible()
   SALOME_ListIteratorOfListIO It( selected );
   for ( ; isCompatible && It.More(); It.Next())
     isCompatible =
-      ( strcmp("GEOM", It.Value()->getComponentDataType()) == 0 ) ||
-      ( strcmp("SMESH", It.Value()->getComponentDataType()) == 0 );
+      ( strcmp("GEOM",        It.Value()->getComponentDataType()) == 0 ) ||
+      ( strcmp("SHAPERSTUDY", It.Value()->getComponentDataType()) == 0 ) ||
+      ( strcmp("SMESH",       It.Value()->getComponentDataType()) == 0 );
 
   return isCompatible;
 }
@@ -4947,7 +5102,7 @@ bool SMESHGUI::isSelectionCompatible()
 bool SMESHGUI::reusableOperation( const int id )
 {
   // compute, evaluate and precompute are not reusable operations
-  return ( id == SMESHOp::OpCompute || id == SMESHOp::OpPreCompute || id == SMESHOp::OpEvaluate ) ? false : SalomeApp_Module::reusableOperation( id );
+  return ( id == SMESHOp::OpCompute || id == SMESHOp::OpPreCompute || id == SMESHOp::OpEvaluate || id == SMESHOp::OpRecompute ) ? false : SalomeApp_Module::reusableOperation( id );
 }
 
 bool SMESHGUI::activateModule( SUIT_Study* study )
@@ -4984,8 +5139,13 @@ bool SMESHGUI::activateModule( SUIT_Study* study )
   if ( aDesk ) {
     QList<SUIT_ViewWindow*> wndList = aDesk->windows();
     SUIT_ViewWindow* wnd;
-    foreach(wnd, wndList) {
-      connectView(wnd);
+    foreach ( wnd, wndList )
+    {
+      connectView( wnd );
+
+      // remove actors whose objects are removed in GetSMESHGen()->UpdateStudy()
+      SMESH::UpdateActorsAfterUpdateStudy(wnd);
+
       wnd->update();
     }
   }
@@ -5268,6 +5428,7 @@ void SMESHGUI::createPreferences()
                              "SMESH", "nb_segments_per_edge" );
   setPreferenceProperty( nbSeg, "min", 1 );
   setPreferenceProperty( nbSeg, "max", 10000000 );
+  addPreference( tr( "PREF_USE_MESHGEMS_HYPOSET" ), segGroup, LightApp_Preferences::Bool, "SMESH", "use-meshgems-hypo-sets" );
 
   int loadGroup = addPreference( tr( "SMESH_PREF_MESH_LOADING" ), genTab );
   addPreference( tr( "PREF_FORGET_MESH_AT_HYP_MODIF" ), loadGroup, LightApp_Preferences::Bool,
@@ -5693,55 +5854,55 @@ LightApp_Operation* SMESHGUI::createOperation( const int id ) const
   // to do : create operation here
   switch( id )
   {
-    case SMESHOp::OpSplitBiQuadratic:
-      op = new SMESHGUI_SplitBiQuadOp();
+  case SMESHOp::OpSplitBiQuadratic:
+    op = new SMESHGUI_SplitBiQuadOp();
     break;
-    case SMESHOp::OpConvertMeshToQuadratic:
-      op = new SMESHGUI_ConvToQuadOp();
+  case SMESHOp::OpConvertMeshToQuadratic:
+    op = new SMESHGUI_ConvToQuadOp();
     break;
-    case SMESHOp::OpCreateBoundaryElements: // create 2D mesh as boundary on 3D
-      op = new SMESHGUI_Make2DFrom3DOp();
+  case SMESHOp::OpCreateBoundaryElements: // create 2D mesh as boundary on 3D
+    op = new SMESHGUI_Make2DFrom3DOp();
     break;
-    case SMESHOp::OpReorientFaces:
-      op = new SMESHGUI_ReorientFacesOp();
-      break;
-    case SMESHOp::OpCreateMesh:
-      op = new SMESHGUI_MeshOp( true, true );
+  case SMESHOp::OpReorientFaces:
+    op = new SMESHGUI_ReorientFacesOp();
     break;
-    case SMESHOp::OpCreateSubMesh:
-      op = new SMESHGUI_MeshOp( true, false );
+  case SMESHOp::OpCreateMesh:
+    op = new SMESHGUI_MeshOp( true, true );
     break;
-    case SMESHOp::OpEditMeshOrSubMesh:
-    case SMESHOp::OpEditMesh:
-    case SMESHOp::OpEditSubMesh:
-      op = new SMESHGUI_MeshOp( false );
+  case SMESHOp::OpCreateSubMesh:
+    op = new SMESHGUI_MeshOp( true, false );
     break;
-    case SMESHOp::OpCompute:
-    case SMESHOp::OpComputeSubMesh:
-      op = new SMESHGUI_ComputeOp();
+  case SMESHOp::OpEditMeshOrSubMesh:
+  case SMESHOp::OpEditMesh:
+  case SMESHOp::OpEditSubMesh:
+    op = new SMESHGUI_MeshOp( false );
     break;
-    case SMESHOp::OpPreCompute:
-      op = new SMESHGUI_PrecomputeOp();
+  case SMESHOp::OpCompute:
+  case SMESHOp::OpComputeSubMesh:
+    op = new SMESHGUI_ComputeOp();
     break;
-    case SMESHOp::OpEvaluate:
-      op = new SMESHGUI_EvaluateOp();
+  case SMESHOp::OpPreCompute:
+    op = new SMESHGUI_PrecomputeOp();
     break;
-    case SMESHOp::OpMeshOrder:
-      op = new SMESHGUI_MeshOrderOp();
+  case SMESHOp::OpEvaluate:
+    op = new SMESHGUI_EvaluateOp();
     break;
-    case SMESHOp::OpCreateGeometryGroup:
-      op = new SMESHGUI_GroupOnShapeOp();
-      break;
-    case SMESHOp::OpFindElementByPoint:
-      op = new SMESHGUI_FindElemByPointOp();
-      break;
-    case SMESHOp::OpMoveNode: // Make mesh pass through point
-      op = new SMESHGUI_MakeNodeAtPointOp();
-      break;
-    case SMESHOp::OpElem0DOnElemNodes: // Create 0D elements on all nodes
-      op = new SMESHGUI_Add0DElemsOnAllNodesOp();
-      break;
-    default:
+  case SMESHOp::OpMeshOrder:
+    op = new SMESHGUI_MeshOrderOp();
+    break;
+  case SMESHOp::OpCreateGeometryGroup:
+    op = new SMESHGUI_GroupOnShapeOp();
+    break;
+  case SMESHOp::OpFindElementByPoint:
+    op = new SMESHGUI_FindElemByPointOp();
+    break;
+  case SMESHOp::OpMoveNode: // Make mesh pass through point
+    op = new SMESHGUI_MakeNodeAtPointOp();
+    break;
+  case SMESHOp::OpElem0DOnElemNodes: // Create 0D elements on all nodes
+    op = new SMESHGUI_Add0DElemsOnAllNodesOp();
+    break;
+  default:
     break;
   }
 
@@ -6195,8 +6356,6 @@ void SMESHGUI::restoreVisualParameters (int savePoint)
 
   // componentName is used for encoding of entries when storing them in IParameters
   std::string componentName = myComponentSMESH->ComponentDataType();
-  //_PTR(SComponent) aSComponent = studyDS->FindComponent("GEOM");
-  //if (!aSComponent) return;
 
   // IParameters
   _PTR(AttributeParameter) ap = studyDS->GetModuleParameters("Interface Applicative",