From 95e36b49a9054fd3fe74ce45539105ec7f996d13 Mon Sep 17 00:00:00 2001 From: mpv Date: Fri, 13 Jul 2018 19:06:34 +0300 Subject: [PATCH] Issue #2515 : optimization of working with folders from the Object Browser --- src/Model/Model_Objects.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) 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 -- 2.39.2