From: azv Date: Fri, 15 Dec 2017 09:21:07 +0000 (+0300) Subject: Issue #2370: History line and folder X-Git-Tag: V_2.10.0RC~17 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7ba2da97915b008af6d05fd89f0eb602ab4593bf;p=modules%2Fshaper.git Issue #2370: History line and folder Skip folders when searching next feature in the history --- diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index bf41c45cc..85a9f6dc2 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -1888,9 +1888,16 @@ FeaturePtr Model_Objects::nextFeature(FeaturePtr theCurrent, const bool theRever std::shared_ptr aData = std::static_pointer_cast(theCurrent->data()); if (aData.get() && aData->isValid()) { TDF_Label aFeatureLabel = aData->label().Father(); - TDF_Label aNextLabel = nextLabel(aFeatureLabel, theReverse); - if (!aNextLabel.IsNull()) - return feature(aNextLabel); + do { + TDF_Label aNextLabel = nextLabel(aFeatureLabel, theReverse); + if (aNextLabel.IsNull()) + break; // last or something is wrong + FeaturePtr aFound = feature(aNextLabel); + if (aFound) + return aFound; // the feature is found + // if the next label is a folder, skip it + aFeatureLabel = folder(aNextLabel).get() ? aNextLabel : TDF_Label(); + } while (!aFeatureLabel.IsNull()); } return FeaturePtr(); // not found, last, or something is wrong }