]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Fix for the problem of activation/deactivation part and current feature to sub-elemen...
authormpv <mpv@opencascade.com>
Mon, 12 Oct 2015 08:39:18 +0000 (11:39 +0300)
committermpv <mpv@opencascade.com>
Mon, 12 Oct 2015 08:39:18 +0000 (11:39 +0300)
src/Model/Model_Session.cpp

index ea5375afbb59077ec613106b6c5c32fa5eff1a5e..172b7d3ff220ffd0e685853b53ffc524b62cb89f 100644 (file)
@@ -219,6 +219,15 @@ std::shared_ptr<ModelAPI_Document> Model_Session::activeDocument()
 static void makeCurrentLast(std::shared_ptr<ModelAPI_Document> theDoc) {
   if (theDoc.get()) {
     FeaturePtr aLast = std::dynamic_pointer_cast<Model_Document>(theDoc)->lastFeature();
+    // if last is nested into something else, make this something else as last:
+    // otherwise it will look like edition of sub-element, so, the main will be disabled
+    if (aLast.get()) {
+      CompositeFeaturePtr aMain = ModelAPI_Tools::compositeOwner(aLast);
+      while(aMain.get()) {
+        aLast = aMain;
+        aMain = ModelAPI_Tools::compositeOwner(aLast);
+      }
+    }
     theDoc->setCurrentFeature(aLast, false);
   }
 }