From 1a5280fd707cbdcddeece38254aef22e121d7a7f Mon Sep 17 00:00:00 2001 From: vsv Date: Thu, 5 Dec 2019 16:59:24 +0300 Subject: [PATCH] Fix color management --- src/PartSet/PartSet_MenuMgr.cpp | 3 +++ src/PartSet/PartSet_Module.cpp | 2 +- src/PartSet/PartSet_SketcherMgr.cpp | 20 +++++++++----------- src/PartSet/PartSet_SketcherMgr.h | 4 ---- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/PartSet/PartSet_MenuMgr.cpp b/src/PartSet/PartSet_MenuMgr.cpp index def7233c9..0ea7aa78d 100644 --- a/src/PartSet/PartSet_MenuMgr.cpp +++ b/src/PartSet/PartSet_MenuMgr.cpp @@ -385,6 +385,7 @@ void PartSet_MenuMgr::setAuxiliary(const bool isChecked) anOpMgr->startOperation(anOpAction); } + static const Events_ID anVisualEvent = Events_Loop::eventByName(EVENT_VISUAL_ATTRIBUTES); if (anObjects.size() > 0) { QObjectPtrList::const_iterator anIt = anObjects.begin(), aLast = anObjects.end(); for (; anIt != aLast; anIt++) { @@ -400,6 +401,7 @@ void PartSet_MenuMgr::setAuxiliary(const bool isChecked) aSketchFeature->data()->attribute(anAttribute)); if (anAuxiliaryAttr) anAuxiliaryAttr->setValue(isChecked); + ModelAPI_EventCreator::get()->sendUpdated(aSketchFeature, anVisualEvent); } } } @@ -408,6 +410,7 @@ void PartSet_MenuMgr::setAuxiliary(const bool isChecked) anOpMgr->commitOperation(); Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED)); + Events_Loop::loop()->flush(anVisualEvent); } bool PartSet_MenuMgr::canSetAuxiliary(bool& theValue) const diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index f3e9a2856..5b5068971 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -1366,7 +1366,7 @@ double getResultTransparency(const ResultPtr& theResult) void PartSet_Module::customizePresentation(const ObjectPtr& theObject, const AISObjectPtr& thePrs) const { - if (mySketchMgr->isSketchStarted()) { + if (mySketchMgr->isObjectOfSketch(theObject)) { mySketchMgr->customizeSketchPresentation(theObject, thePrs); } else { diff --git a/src/PartSet/PartSet_SketcherMgr.cpp b/src/PartSet/PartSet_SketcherMgr.cpp index bd4c35fae..e82577145 100644 --- a/src/PartSet/PartSet_SketcherMgr.cpp +++ b/src/PartSet/PartSet_SketcherMgr.cpp @@ -172,8 +172,7 @@ PartSet_SketcherMgr::PartSet_SketcherMgr(PartSet_Module* theModule) : QObject(theModule), myModule(theModule), myIsEditLaunching(false), myIsDragging(false), myDragDone(false), myIsMouseOverWindow(false), myIsMouseOverViewProcessed(true), myPreviousUpdateViewerEnabled(true), - myIsPopupMenuActive(false), myExternalPointsMgr(0), myNoDragMoving(false), - myIsSketchStarted(false) + myIsPopupMenuActive(false), myExternalPointsMgr(0), myNoDragMoving(false) { ModuleBase_IWorkshop* anIWorkshop = myModule->workshop(); ModuleBase_IViewer* aViewer = anIWorkshop->viewer(); @@ -1028,7 +1027,6 @@ void PartSet_SketcherMgr::startSketch(ModuleBase_Operation* theOperation) if (!aFOperation) return; - myIsSketchStarted = true; SketcherPrs_Tools::setPixelRatio(ModuleBase_Tools::currentPixelRatio()); myModule->onViewTransformed(); @@ -1151,8 +1149,6 @@ void PartSet_SketcherMgr::stopSketch(ModuleBase_Operation* theOperation) myModule->workshop()->viewer()->setFitter(0); delete aFitter; - myIsSketchStarted = false; - myIsMouseOverWindow = false; myIsConstraintsShown[PartSet_Tools::Geometrical] = true; myIsConstraintsShown[PartSet_Tools::Dimensional] = true; @@ -1578,17 +1574,19 @@ const QMap& PartSet_SketcherMgr::sh bool PartSet_SketcherMgr::isObjectOfSketch(const ObjectPtr& theObject) const { - bool isFoundObject = false; - + if (!myCurrentSketch.get()) + return false; FeaturePtr anObjectFeature = ModelAPI_Feature::feature(theObject); if (anObjectFeature.get()) { int aSize = myCurrentSketch->numberOfSubs(); - for (int i = 0; i < aSize && !isFoundObject; i++) { - FeaturePtr aCurrentFeature = myCurrentSketch->subFeature(i); - isFoundObject = myCurrentSketch->subFeature(i) == anObjectFeature; + FeaturePtr aCurrentFeature; + for (int i = 0; i < aSize; i++) { + aCurrentFeature = myCurrentSketch->subFeature(i); + if (myCurrentSketch->subFeature(i) == anObjectFeature) + return true; } } - return isFoundObject; + return false; } void PartSet_SketcherMgr::onPlaneSelected(const std::shared_ptr& thePlane) diff --git a/src/PartSet/PartSet_SketcherMgr.h b/src/PartSet/PartSet_SketcherMgr.h index 092982f52..20ee6e659 100644 --- a/src/PartSet/PartSet_SketcherMgr.h +++ b/src/PartSet/PartSet_SketcherMgr.h @@ -380,8 +380,6 @@ public: */ virtual void processEvent(const std::shared_ptr& theMessage); - bool isSketchStarted() const { return myIsSketchStarted; } - public slots: /// Process sketch plane selected event @@ -511,8 +509,6 @@ private: QMap myPointsHighlight; bool myNoDragMoving; - - bool myIsSketchStarted; }; -- 2.39.2