From a0ad7f2591490897dd053b459a1353ebf0ba61f2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me?= Date: Wed, 9 Dec 2020 17:37:41 +0100 Subject: [PATCH] Fixed issue for ctest --- src/ModelAPI/ModelAPI_Feature.cpp | 14 +++++--- src/PartSet/PartSet_Module.cpp | 3 +- src/XGUI/XGUI_Workshop.cpp | 59 ++++++++++++++++--------------- 3 files changed, 42 insertions(+), 34 deletions(-) diff --git a/src/ModelAPI/ModelAPI_Feature.cpp b/src/ModelAPI/ModelAPI_Feature.cpp index 0307d08cc..84fcecef1 100644 --- a/src/ModelAPI/ModelAPI_Feature.cpp +++ b/src/ModelAPI/ModelAPI_Feature.cpp @@ -74,12 +74,16 @@ void ModelAPI_Feature::setResult(const std::shared_ptr& theResu if (!isDisabled()) // disabled feature may be executed when it is added as not enabled (#2078) theResult->setDisabled(theResult, false); - bool anIsAutoColor = Config_PropManager::boolean("Visualization", "result_group_Auto_color"); + Config_Prop* aProp = Config_PropManager::findProp("Visualization", "result_group_Auto_color"); - if (anIsAutoColor && theResult->groupName() == ModelAPI_ResultGroup::group()) { - std::vector aColor; - ModelAPI_Tools::findRandomColor(aColor); - ModelAPI_Tools::setColor(theResult, aColor); + if (aProp) { + bool anIsAutoColor = Config_PropManager::boolean("Visualization", "result_group_Auto_color"); + + if (anIsAutoColor && theResult->groupName() == ModelAPI_ResultGroup::group()) { + std::vector aColor; + ModelAPI_Tools::findRandomColor(aColor); + ModelAPI_Tools::setColor(theResult, aColor); + } } } diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 0f3a4cfd1..62ed1bd1f 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -1659,7 +1659,8 @@ void PartSet_Module::processEvent(const std::shared_ptr& theMess CompositeFeaturePtr aSketch = mySketchMgr->activeSketch(); if (aSketch.get()) { ModuleBase_Operation* anOperation = myWorkshop->currentOperation(); - if (PartSet_SketcherMgr::isSketchOperation(anOperation)) + if (PartSet_SketcherMgr::isSketchOperation(anOperation)&& + mySketchMgr->previewSketchPlane()->isDisplayed()) mySketchMgr->previewSketchPlane()->createSketchPlane(aSketch, myWorkshop); } } diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp index 76605cbae..910306380 100644 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -2518,40 +2518,43 @@ void XGUI_Workshop::changeAutoColor(const QObjectPtrList& theObjects) aMgr->startOperation(aDescription.toStdString()); Config_Prop* aProp = Config_PropManager::findProp("Visualization", "result_group_Auto_color"); - bool anIsAutoColor = Config_PropManager::boolean("Visualization", "result_group_Auto_color"); - if (anIsAutoColor) { - contextMenuMgr()->action("AUTOCOLOR_CMD")->setText(tr("Auto color")); - aProp->setValue("false"); - } else { - // set the value to all results - foreach (ObjectPtr anObj, theObjects) { - DocumentPtr aDocument = anObj->document(); - std::list anAllFeatures = allFeatures(aDocument); - // find the object iterator - std::list::iterator aObjectIt = anAllFeatures.begin(); - for (; aObjectIt != anAllFeatures.end(); ++ aObjectIt) { - FeaturePtr aFeature = *aObjectIt; - if (aFeature.get()) { - std::list aResults; - ModelAPI_Tools::allResults(aFeature, aResults); - std::list >::const_iterator aIt; - for (aIt = aResults.cbegin(); aIt != aResults.cend(); aIt++) { - ResultPtr aGroupResult = *aIt; - if (aGroupResult.get() && aGroupResult->groupName() == ModelAPI_ResultGroup::group()) { - ModelAPI_Tools::findRandomColor(aColor); - ModelAPI_Tools::setColor(aGroupResult, aColor); + if (aProp) { + bool anIsAutoColor = Config_PropManager::boolean("Visualization", "result_group_Auto_color"); + + if (anIsAutoColor) { + contextMenuMgr()->action("AUTOCOLOR_CMD")->setText(tr("Auto color")); + aProp->setValue("false"); + } else { + // set the value to all results + foreach (ObjectPtr anObj, theObjects) { + DocumentPtr aDocument = anObj->document(); + std::list anAllFeatures = allFeatures(aDocument); + // find the object iterator + std::list::iterator aObjectIt = anAllFeatures.begin(); + for (; aObjectIt != anAllFeatures.end(); ++ aObjectIt) { + FeaturePtr aFeature = *aObjectIt; + if (aFeature.get()) { + std::list aResults; + ModelAPI_Tools::allResults(aFeature, aResults); + std::list >::const_iterator aIt; + for (aIt = aResults.cbegin(); aIt != aResults.cend(); aIt++) { + ResultPtr aGroupResult = *aIt; + if (aGroupResult.get() && aGroupResult->groupName() == ModelAPI_ResultGroup::group()) { + ModelAPI_Tools::findRandomColor(aColor); + ModelAPI_Tools::setColor(aGroupResult, aColor); + } } } } } + Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); + aMgr->finishOperation(); + updateCommandStatus(); + myViewerProxy->update(); + contextMenuMgr()->action("AUTOCOLOR_CMD")->setText(tr("Disable auto color")); + aProp->setValue("true"); } - Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY)); - aMgr->finishOperation(); - updateCommandStatus(); - myViewerProxy->update(); - contextMenuMgr()->action("AUTOCOLOR_CMD")->setText(tr("Disable auto color")); - aProp->setValue("true"); } } -- 2.39.2