From 5fea3f89cb0f16848b1217193c13fda0a596c754 Mon Sep 17 00:00:00 2001 From: vsv Date: Tue, 5 Mar 2019 11:23:43 +0300 Subject: [PATCH] Issue #2876: Fix synchronization of objects display on module activation --- src/SHAPERGUI/SHAPERGUI.cpp | 1 + src/XGUI/XGUI_Workshop.cpp | 18 +++++++++++++++++- src/XGUI/XGUI_Workshop.h | 3 +++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/SHAPERGUI/SHAPERGUI.cpp b/src/SHAPERGUI/SHAPERGUI.cpp index 4b74af5ae..c0becb578 100644 --- a/src/SHAPERGUI/SHAPERGUI.cpp +++ b/src/SHAPERGUI/SHAPERGUI.cpp @@ -204,6 +204,7 @@ void SHAPERGUI::initialize(CAM_Application* theApp) aViewPort->installEventFilter(aViewer); Handle(V3d_View) aView = aViewPort->getView(); aViewer->SetScale(aView, aView->Camera()->Scale()); + onViewManagerAdded(aMgr); } } } diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 2660cb93b..f1d5d4f36 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -2700,12 +2700,28 @@ void XGUI_Workshop::synchronizeGroupInViewer(const DocumentPtr& theDoc, ResultPtr aRes = std::dynamic_pointer_cast(aObj); if (aRes.get() && (!aRes->shape().get() || aRes->shape()->isNull())) continue; - myDisplayer->display(aObj, false); + ResultBodyPtr aResBody = std::dynamic_pointer_cast(aObj); + if (aResBody.get()) + synchronizeResultTree(aResBody, false); + else + myDisplayer->display(aObj, false); } } if (theUpdateViewer) myDisplayer->updateViewer(); } + +void XGUI_Workshop::synchronizeResultTree(const ResultBodyPtr& theRes, bool theUpdateViewer) +{ + if (theRes->numberOfSubs() > 0) + for (int i = 0; i < theRes->numberOfSubs(); i++) { + ResultBodyPtr aRes = theRes->subResult(i); + if (aRes.get()) + synchronizeResultTree(aRes, theUpdateViewer); + } + else + myDisplayer->display(theRes, theUpdateViewer); +} #endif //****************************************************** diff --git a/src/XGUI/XGUI_Workshop.h b/src/XGUI/XGUI_Workshop.h index ea1ecf094..01c75a373 100644 --- a/src/XGUI/XGUI_Workshop.h +++ b/src/XGUI/XGUI_Workshop.h @@ -24,6 +24,7 @@ #include #include +#include #include #include @@ -287,6 +288,8 @@ Q_OBJECT const std::string& theGroup, bool theUpdateViewer); + void synchronizeResultTree(const ResultBodyPtr& theRes, bool theUpdateViewer); + #endif /// Update the property panel content by the XML description of the operation and set the panel /// into the operation -- 2.39.2