From 575a81e93bbdebf521e34bcb4396451b38b25ab7 Mon Sep 17 00:00:00 2001 From: vsv Date: Wed, 22 Aug 2018 18:34:49 +0300 Subject: [PATCH] Issue #2605: Fix visibility state for complex objects with nesting more then 2 --- src/PartSet/PartSet_TreeNodes.cpp | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/PartSet/PartSet_TreeNodes.cpp b/src/PartSet/PartSet_TreeNodes.cpp index dbdbc4214..8cd065e16 100644 --- a/src/PartSet/PartSet_TreeNodes.cpp +++ b/src/PartSet/PartSet_TreeNodes.cpp @@ -159,21 +159,24 @@ PartSet_ObjectNode::VisibilityState PartSet_ObjectNode::visibilityState() const ModuleBase_IWorkshop* aWork = workshop(); ResultBodyPtr aCompRes = std::dynamic_pointer_cast(aResObj); if (aCompRes.get()) { - VisibilityState aState = aCompRes->numberOfSubs(true) == 0 ? - (aWork->isVisible(aCompRes) ? Visible : Hidden) : NoneState; std::list aResultsList; ModelAPI_Tools::allSubs(aCompRes, aResultsList); + VisibilityState aState = aResultsList.size() == 0 ? + (aWork->isVisible(aCompRes) ? Visible : Hidden) : NoneState; std::list::const_iterator aIt; - //for (int i = 0; i < aCompRes->numberOfSubs(true); i++) { + ResultBodyPtr aCompSub; for (aIt = aResultsList.cbegin(); aIt != aResultsList.cend(); aIt++) { - ResultPtr aSubRes = (*aIt); // aCompRes->subResult(i, true); - VisibilityState aS = aWork->isVisible(aSubRes) ? Visible : Hidden; - if (aState == NoneState) - aState = aS; - else if (aState != aS) { - aState = SemiVisible; - break; + ResultPtr aSubRes = (*aIt); + aCompSub = std::dynamic_pointer_cast(aSubRes); + if (!(aCompSub.get() && aCompSub->numberOfSubs() > 0)) { + VisibilityState aS = aWork->isVisible(aSubRes) ? Visible : Hidden; + if (aState == NoneState) + aState = aS; + else if (aState != aS) { + aState = SemiVisible; + break; + } } } return aState; -- 2.39.2