From: mpv Date: Fri, 13 Jul 2018 16:06:34 +0000 (+0300) Subject: Issue #2515 : optimization of working with folders from the Object Browser X-Git-Tag: SHAPER_V9_1_0RC1~73^2~51 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=95e36b49a9054fd3fe74ce45539105ec7f996d13;p=modules%2Fshaper.git Issue #2515 : optimization of working with folders from the Object Browser --- diff --git a/src/Model/Model_Objects.cpp b/src/Model/Model_Objects.cpp index fe5ac904f..ea15cc5df 100644 --- a/src/Model/Model_Objects.cpp +++ b/src/Model/Model_Objects.cpp @@ -1732,14 +1732,25 @@ FolderPtr Model_Objects::findContainingFolder(const FeaturePtr& theFeature, int& for (int aRefIndex = aRefs->Lower(); aRefIndex <= aRefs->Upper(); ++aRefIndex) { TDF_Label aCurLabel = aRefs->Value(aRefIndex); - if (isSkippedFeature(feature(aCurLabel))) - continue; if (aFoundFolder) ++theIndexInFolder; - if (aCurLabel == aLabelToFind) // the feature is reached + if (aCurLabel == aLabelToFind) { // the feature is reached + if (aFoundFolder) { + if (isSkippedFeature(theFeature)) { + theIndexInFolder = -1; + return false; + } + // decrease the index of the feature in the folder by the number of skipped features + for (int anIndex = theIndexInFolder - 1; anIndex > 0; anIndex--) { + aCurLabel = aRefs->Value(aRefIndex - anIndex); + if (isSkippedFeature(feature(aCurLabel))) + theIndexInFolder--; + } + } return aFoundFolder; + } if (!aFoundFolder) { // if the current label refers to a folder, feel all necessary data