From: nds Date: Wed, 7 Sep 2016 12:02:29 +0000 (+0300) Subject: #1721 Selecting arcs in mirror constraint is too long and removes other edges X-Git-Tag: V_2.5.0~26 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c1d1f617a04aacf5f0d6246c1b8dea72dd2d6093;p=modules%2Fshaper.git #1721 Selecting arcs in mirror constraint is too long and removes other edges Reason: Redisplay for not-modified AIS presentation is called, that led to selection lost. --- diff --git a/src/SketchPlugin/SketchPlugin_SketchEntity.h b/src/SketchPlugin/SketchPlugin_SketchEntity.h index 3174d09ea..1fd0472f7 100644 --- a/src/SketchPlugin/SketchPlugin_SketchEntity.h +++ b/src/SketchPlugin/SketchPlugin_SketchEntity.h @@ -104,7 +104,20 @@ class SketchPlugin_SketchEntity : public SketchPlugin_Feature, public GeomAPI_IC virtual bool customisePresentation(ResultPtr theResult, AISObjectPtr thePrs, std::shared_ptr theDefaultPrs) { - //bool isCustomized = false; + /// Store previous color values of the presentation to check it after setting specific entity + /// color. Default color is set into presentation to have not modified isCustomized state + /// after default customize prs is completed. + std::vector aPrevColor; + aPrevColor.resize(3); + thePrs->getColor(aPrevColor[0], aPrevColor[1], aPrevColor[2]); + { + std::string aSection, aName, aDefault; + theResult->colorConfigInfo(aSection, aName, aDefault); + std::vector aColor; + aColor = Config_PropManager::color(aSection, aName, aDefault); + thePrs->setColor(aColor[0], aColor[1], aColor[2]); + } + bool isCustomized = theDefaultPrs.get() != NULL && theDefaultPrs->customisePresentation(theResult, thePrs, theDefaultPrs); int aShapeType = thePrs->getShapeType(); @@ -129,8 +142,11 @@ class SketchPlugin_SketchEntity : public SketchPlugin_Feature, public GeomAPI_IC aColor = Config_PropManager::color("Visualization", "sketch_entity_color", SKETCH_ENTITY_COLOR); } - if (!aColor.empty()) - isCustomized = thePrs->setColor(aColor[0], aColor[1], aColor[2]) || isCustomized; + if (!aColor.empty()) { + thePrs->setColor(aColor[0], aColor[1], aColor[2]); + for (int i = 0; i < 3 && !isCustomized; i++) + isCustomized = aColor[i] != aPrevColor[i]; + } if (aShapeType == 6 || aShapeType == 0) { // if this is an edge or a compound if (isConstruction) {