From: jfa Date: Thu, 8 Apr 2021 10:02:06 +0000 (+0300) Subject: Bos #24043: EDF 23094 - problem with dump. Fix for nested compounds. X-Git-Tag: V9_7_0a1~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=58e4f7ee6cf63a7b3d48ae74d8c6f09908ccf8cf;p=modules%2Fshaper.git Bos #24043: EDF 23094 - problem with dump. Fix for nested compounds. --- diff --git a/src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp b/src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp index 8e44be6a9..741298f5a 100644 --- a/src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp +++ b/src/ModuleBase/ModuleBase_WidgetSelectionFilter.cpp @@ -478,16 +478,22 @@ void ModuleBase_WidgetSelectionFilter::onSelect() aBuilder.Add(aComp, aTShape); // bos #24043: Naming on a compsolid works wrong. // Find a simple sub-result for the ViewerPrs context: - ObjectPtr aSubResultObj = aObj; - for (int aSubIndex = 0; aSubIndex < aBody->numberOfSubs(); aSubIndex++) { - ResultBodyPtr aSubResult = aBody->subResult(aSubIndex); - GeomShapePtr aSubResultShape = aSubResult->shape(); - if (aSubResultShape->isSubShape(aSubShape)) { - aSubResultObj = aSubResult; - break; + ResultBodyPtr aContext = aBody; + bool isComposite = aContext->numberOfSubs() > 0; + while (isComposite) { + isComposite = false; + int nbSubs = aContext->numberOfSubs(); + for (int aSubIndex = 0; aSubIndex < nbSubs; aSubIndex++) { + ResultBodyPtr aSubResult = aContext->subResult(aSubIndex); + GeomShapePtr aSubResultShape = aSubResult->shape(); + if (aSubResultShape->isSubShape(aSubShape)) { + aContext = aSubResult; + isComposite = aContext->numberOfSubs() > 0; + break; + } } } - ModuleBase_ViewerPrsPtr aValue(new ModuleBase_ViewerPrs(aSubResultObj, aSubShape)); + ModuleBase_ViewerPrsPtr aValue(new ModuleBase_ViewerPrs(aContext, aSubShape)); //ModuleBase_ViewerPrsPtr aValue(new ModuleBase_ViewerPrs(aObj, aSubShape)); myValues.append(aValue); }