From: azv Date: Tue, 30 Nov 2021 19:35:48 +0000 (+0300) Subject: Use an option from SHAPER's Preferences to specify what shapes should be displayed... X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3a7bd8efdc72294259185cd728251eb37a300ba5;p=modules%2Fshaper.git Use an option from SHAPER's Preferences to specify what shapes should be displayed even if SHAPER module is not active yet. --- diff --git a/src/ModelHighAPI/ModelHighAPI_Interface.cpp b/src/ModelHighAPI/ModelHighAPI_Interface.cpp index 82423fb0b..bd87cd0e4 100644 --- a/src/ModelHighAPI/ModelHighAPI_Interface.cpp +++ b/src/ModelHighAPI/ModelHighAPI_Interface.cpp @@ -82,7 +82,7 @@ void ModelHighAPI_Interface::execute(bool isForce) Events_Loop* aLoop = Events_Loop::loop(); aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_CREATED)); aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); - //aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); //aLoop->flush(Events_Loop::eventByName(EVENT_OBJECT_DELETED)); } diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index a572b5294..0336029ba 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -706,21 +706,6 @@ void XGUI_Workshop::deactivateActiveObject(const ObjectPtr& theObject, const boo myDisplayer->deactivateObjects(anObjects, theUpdateViewer); } } - - SUIT_Application * app = SUIT_Session::session()->activeApplication(); - - QVariant aVar = app->property("IsLoadedScript"); - - if (!aVar.isNull() && aVar.toBool()) { - DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument(); - int aSize = aRootDoc->size(ModelAPI_ResultPart::group()); - if (aSize > 0) { - ObjectPtr anPartObject = aRootDoc->object(ModelAPI_ResultPart::group(), aSize - 1); - ResultPartPtr aPart = std::dynamic_pointer_cast(anPartObject); - XGUI_Tools::setDisplaying(aPart, true); - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); - } - } } //****************************************************** diff --git a/src/XGUI/XGUI_WorkshopListener.cpp b/src/XGUI/XGUI_WorkshopListener.cpp index 8a3f3d181..7dc112a93 100644 --- a/src/XGUI/XGUI_WorkshopListener.cpp +++ b/src/XGUI/XGUI_WorkshopListener.cpp @@ -62,10 +62,10 @@ #include "XGUI_OperationMgr.h" #include "XGUI_ModuleConnector.h" #include "XGUI_PropertyPanel.h" - #include "XGUI_QtEvents.h" #include "XGUI_SalomeConnector.h" #include "XGUI_SelectionMgr.h" +#include "XGUI_Tools.h" #include "XGUI_Workshop.h" #include @@ -378,6 +378,21 @@ void XGUI_WorkshopListener:: } } } + + // If the python script is being loaded now, the preferences should be used + // to display the required object + SUIT_Application * app = SUIT_Session::session()->activeApplication(); + QVariant aVar = app->property("IsLoadedScript"); + if (!aVar.isNull() && aVar.toBool()) { + DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument(); + int aSize = aRootDoc->size(ModelAPI_ResultPart::group()); + if (aSize > 0) { + ObjectPtr anPartObject = aRootDoc->object(ModelAPI_ResultPart::group(), aSize - 1); + ResultPartPtr aPart = std::dynamic_pointer_cast(anPartObject); + XGUI_Tools::setDisplaying(aPart, true); + } + } + // this processing should be moved in another place in order to do not cause problems in // flush messages chain //if (aHiddenObjects.size() > 0)