Salome HOME
Merge remote-tracking branch 'remotes/origin/master' into CEA_2019
[modules/shaper.git] / src / PartSet / PartSet_WidgetSketchLabel.cpp
index 3f4c8d82990cdffa479015483714a616858e2a38..dafd2526ff3e44a57c511dcf38c9b1100d148f8f 100644 (file)
@@ -551,6 +551,12 @@ void PartSet_WidgetSketchLabel::deactivate()
 
   if (aHidePreview)
     myWorkshop->viewer()->update();
+
+  if (myOpenTransaction) {
+    SessionPtr aMgr = ModelAPI_Session::get();
+    aMgr->finishOperation();
+    myOpenTransaction = false;
+  }
 }
 
 void PartSet_WidgetSketchLabel::selectionModes(int& theModuleSelectionModes, QIntList& theModes)
@@ -692,6 +698,13 @@ void PartSet_WidgetSketchLabel::onChangePlane()
     myRemoveExternal->setVisible(true);
     myStackWidget->setCurrentIndex(0);
 
+    bool aBodyIsVisualized = myPreviewPlanes->hasVisualizedBodies(myWorkshop);
+
+    if (!aBodyIsVisualized) {
+      // We have to select a plane before any operation
+      myPreviewPlanes->showPreviewPlanes(myWorkshop);
+    }
+
     CompositeFeaturePtr aSketch = std::dynamic_pointer_cast<ModelAPI_CompositeFeature>(myFeature);
     PartSet_Tools::nullifySketchPlane(aSketch);