Salome HOME
Debug of movement of part results
[modules/shaper.git] / src / Model / Model_Document.cpp
index 1cdd0bcf190a588d4d80b35d49c42ead042b2adf..6e9fbf778da1aeca0802669c0e14285f9681ff9c 100644 (file)
@@ -14,6 +14,7 @@
 #include <ModelAPI_Validator.h>
 #include <ModelAPI_CompositeFeature.h>
 #include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_Tools.h>
 
 #include <Events_Loop.h>
 #include <Events_Error.h>
@@ -660,7 +661,8 @@ std::shared_ptr<ModelAPI_Feature> Model_Document::currentFeature(const bool theV
     TDF_Label aLab = aRef->Get();
     FeaturePtr aResult = myObjs->feature(aLab);
     if (theVisible) { // get nearest visible (in history) going up
-      while(aResult.get() && !aResult->isInHistory()) {
+      while(aResult.get() &&  // sub-composites are never in history
+             (!aResult->isInHistory() || ModelAPI_Tools::compositeOwner(aResult).get())) {
         aResult = myObjs->nextFeature(aResult, true);
       }
     }
@@ -972,3 +974,10 @@ AttributeSelectionListPtr Model_Document::selectionInPartFeature()
   }
   return mySelectionFeature->selectionList("selection");
 }
+
+FeaturePtr Model_Document::lastFeature()
+{
+  if (myObjs)
+    return myObjs->lastFeature();
+  return FeaturePtr();
+}