From f5da655429914fa74fbdd12e67217adc5f236040 Mon Sep 17 00:00:00 2001 From: PaddleStroke Date: Fri, 22 Mar 2024 13:38:14 +0100 Subject: [PATCH] Sketcher: Points color reflect their construction state. Remove Vertex color. --- .../Sketcher_Colors.cfg | 2 - src/Mod/Sketcher/Gui/EditModeCoinManager.cpp | 8 --- .../Gui/EditModeCoinManagerParameters.cpp | 5 -- .../Gui/EditModeCoinManagerParameters.h | 14 +++-- .../Gui/EditModeGeometryCoinConverter.cpp | 19 ++++++ .../Gui/EditModeGeometryCoinManager.cpp | 14 +++-- src/Mod/Sketcher/Gui/SketcherSettings.cpp | 4 -- .../Gui/SketcherSettingsAppearance.ui | 61 +------------------ 8 files changed, 38 insertions(+), 89 deletions(-) diff --git a/src/Gui/PreferencePackTemplates/Sketcher_Colors.cfg b/src/Gui/PreferencePackTemplates/Sketcher_Colors.cfg index 994b1dfd8c..47b0f20ecd 100644 --- a/src/Gui/PreferencePackTemplates/Sketcher_Colors.cfg +++ b/src/Gui/PreferencePackTemplates/Sketcher_Colors.cfg @@ -7,7 +7,6 @@ - @@ -16,7 +15,6 @@ - diff --git a/src/Mod/Sketcher/Gui/EditModeCoinManager.cpp b/src/Mod/Sketcher/Gui/EditModeCoinManager.cpp index b88aaad185..bc730b4683 100644 --- a/src/Mod/Sketcher/Gui/EditModeCoinManager.cpp +++ b/src/Mod/Sketcher/Gui/EditModeCoinManager.cpp @@ -181,10 +181,6 @@ void EditModeCoinManager::ParameterObserver::initParameters() [this, drawingParameters = Client.drawingParameters](const std::string& param) { updateColor(drawingParameters.CreateCurveColor, param); }}, - {"EditedVertexColor", - [this, drawingParameters = Client.drawingParameters](const std::string& param) { - updateColor(drawingParameters.VertexColor, param); - }}, {"EditedEdgeColor", [this, drawingParameters = Client.drawingParameters](const std::string& param) { updateColor(drawingParameters.CurveColor, param); @@ -209,10 +205,6 @@ void EditModeCoinManager::ParameterObserver::initParameters() [this, drawingParameters = Client.drawingParameters](const std::string& param) { updateColor(drawingParameters.FullyConstraintInternalAlignmentColor, param); }}, - {"FullyConstraintConstructionPointColor", - [this, drawingParameters = Client.drawingParameters](const std::string& param) { - updateColor(drawingParameters.FullyConstraintConstructionPointColor, param); - }}, {"FullyConstraintElementColor", [this, drawingParameters = Client.drawingParameters](const std::string& param) { updateColor(drawingParameters.FullyConstraintElementColor, param); diff --git a/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.cpp b/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.cpp index 005739b502..aecf0ad0b6 100644 --- a/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.cpp +++ b/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.cpp @@ -38,11 +38,6 @@ SbColor 0.87f, 0.78f); // #DEDEC8 -> (222,222,200) SbColor DrawingParameters::InternalAlignedGeoColor(0.7f, 0.7f, 0.5f); // #B2B27F -> (178,178,127) -SbColor - DrawingParameters::FullyConstraintConstructionPointColor(1.0f, - 0.58f, - 0.50f); // #FF9580 -> (255,149,128) -SbColor DrawingParameters::VertexColor(1.0f, 0.149f, 0.0f); // #FF2600 -> (255, 38, 0) SbColor DrawingParameters::FullyConstraintElementColor(0.50f, 0.81f, 0.62f); // #80D0A0 -> (128,208,160) diff --git a/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.h b/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.h index 19a77466e6..4c445d3c4f 100644 --- a/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.h +++ b/src/Mod/Sketcher/Gui/EditModeCoinManagerParameters.h @@ -106,11 +106,7 @@ struct DrawingParameters static SbColor FullyConstrainedColor; // Color for a fully constrained sketch static SbColor FullyConstraintInternalAlignmentColor; // Color for fully constrained internal // alignment geometry - static SbColor - InternalAlignedGeoColor; // Color for non-fully constrained internal alignment geometry - static SbColor - FullyConstraintConstructionPointColor; // Color for fully constrained construction points - static SbColor VertexColor; // Color for vertices + static SbColor InternalAlignedGeoColor; // Color for non-fully constrained internal geometry static SbColor FullyConstraintElementColor; // Color for a fully constrained element static SbColor CurveColor; // Color for curves static SbColor PreselectColor; // Color used for pre-selection @@ -473,6 +469,7 @@ struct CoinMapping } CurvIdToGeoId.clear(); PointIdToGeoId.clear(); + PointIdToPosId.clear(); GeoElementId2SetId.clear(); PointIdToVertexId.clear(); }; @@ -489,6 +486,12 @@ struct CoinMapping { return PointIdToGeoId[layerindex][pointindex]; } + /// given the MF index of a point and the coin layer in which it is drawn returns the PosId of + /// the point + Sketcher::PointPos getPointPosId(int pointindex, int layerindex) + { + return PointIdToPosId[layerindex][pointindex]; + } /// given the MF index of a point and the coin layer in which it is drawn returns the VertexId /// of the point int getPointVertexId(int pointindex, int layerindex) @@ -531,6 +534,7 @@ struct CoinMapping std::vector>> CurvIdToGeoId; // conversion of SoLineSet index to GeoId std::vector> PointIdToGeoId; // conversion of SoCoordinate3 index to GeoId + std::vector> PointIdToPosId; // SoCoordinate3 index to PosId //* This maps an MF index (second index) of a point within a coin layer (first index) to a // global VertexId */ diff --git a/src/Mod/Sketcher/Gui/EditModeGeometryCoinConverter.cpp b/src/Mod/Sketcher/Gui/EditModeGeometryCoinConverter.cpp index 5235a0224c..cc7acca2c7 100644 --- a/src/Mod/Sketcher/Gui/EditModeGeometryCoinConverter.cpp +++ b/src/Mod/Sketcher/Gui/EditModeGeometryCoinConverter.cpp @@ -75,6 +75,7 @@ void EditModeGeometryCoinConverter::convert(const Sketcher::GeoListFacade& geoli coinMapping.CurvIdToGeoId[l].emplace_back(); } coinMapping.PointIdToGeoId.emplace_back(); + coinMapping.PointIdToPosId.emplace_back(); coinMapping.PointIdToVertexId.emplace_back(); } @@ -86,6 +87,7 @@ void EditModeGeometryCoinConverter::convert(const Sketcher::GeoListFacade& geoli // empty layer. Points[0].emplace_back(0., 0., 0.); coinMapping.PointIdToGeoId[0].push_back(-1); // root point + coinMapping.PointIdToPosId[0].push_back(Sketcher::PointPos::start); coinMapping.PointIdToVertexId[0].push_back(-1); // VertexId is the reference used for point selection/preselection @@ -150,6 +152,23 @@ void EditModeGeometryCoinConverter::convert(const Sketcher::GeoListFacade& geoli for (int i = 0; i < numberPoints; i++) { coinMapping.PointIdToGeoId[coinLayer].push_back(geoId); + Sketcher::PointPos pos; + if (i == 0) { + if (pointmode == PointsMode::InsertMidOnly) { + pos = Sketcher::PointPos::mid; + } + else { + pos = Sketcher::PointPos::start; + } + } + else if (i == 1) { + pos = Sketcher::PointPos::end; + } + else { + pos = Sketcher::PointPos::mid; + } + + coinMapping.PointIdToPosId[coinLayer].push_back(pos); coinMapping.PointIdToVertexId[coinLayer].push_back(vertexCounter++); } diff --git a/src/Mod/Sketcher/Gui/EditModeGeometryCoinManager.cpp b/src/Mod/Sketcher/Gui/EditModeGeometryCoinManager.cpp index 8c6b030a34..afcf6f5100 100644 --- a/src/Mod/Sketcher/Gui/EditModeGeometryCoinManager.cpp +++ b/src/Mod/Sketcher/Gui/EditModeGeometryCoinManager.cpp @@ -124,10 +124,12 @@ void EditModeGeometryCoinManager::updateGeometryColor(const GeoListFacade& geoli bool issketchinvalid) { // Lambdas for convenience retrieval of geometry information - auto isDefinedGeomPoint = [&geolistfacade](int GeoId) { + auto isDefinedGeomPoint = [&geolistfacade](int GeoId, Sketcher::PointPos PosId) { auto geom = geolistfacade.getGeometryFacadeFromGeoId(GeoId); if (geom) { - return geom->isGeoType(Part::GeomPoint::getClassTypeId()) && !geom->getConstruction(); + bool isStartOrEnd = + PosId == Sketcher::PointPos::start || PosId == Sketcher::PointPos::end; + return isStartOrEnd && !geom->getConstruction(); } return false; }; @@ -185,6 +187,7 @@ void EditModeGeometryCoinManager::updateGeometryColor(const GeoListFacade& geoli } else { int GeoId = coinMapping.getPointGeoId(i, l); + Sketcher::PointPos PosId = coinMapping.getPointPosId(i, l); bool constrainedElement = isFullyConstraintElement(GeoId); @@ -197,12 +200,13 @@ void EditModeGeometryCoinManager::updateGeometryColor(const GeoListFacade& geoli } } else { - if (!isDefinedGeomPoint(GeoId)) { + if (!isDefinedGeomPoint(GeoId, PosId)) { if (constrainedElement) { - pcolor[i] = drawingParameters.FullyConstraintConstructionPointColor; + pcolor[i] = + drawingParameters.FullyConstraintConstructionElementColor; } else { - pcolor[i] = drawingParameters.VertexColor; + pcolor[i] = drawingParameters.CurveDraftColor; } } else { // this is a defined GeomPoint diff --git a/src/Mod/Sketcher/Gui/SketcherSettings.cpp b/src/Mod/Sketcher/Gui/SketcherSettings.cpp index 4e6ca319a3..ca7b908ab3 100644 --- a/src/Mod/Sketcher/Gui/SketcherSettings.cpp +++ b/src/Mod/Sketcher/Gui/SketcherSettings.cpp @@ -523,7 +523,6 @@ void SketcherSettingsAppearance::saveSettings() ui->SketchEdgeColor->onSave(); ui->SketchVertexColor->onSave(); ui->EditedEdgeColor->onSave(); - ui->EditedVertexColor->onSave(); ui->ConstructionColor->onSave(); ui->ExternalColor->onSave(); ui->InvalidSketchColor->onSave(); @@ -532,7 +531,6 @@ void SketcherSettingsAppearance::saveSettings() ui->FullyConstraintElementColor->onSave(); ui->FullyConstraintConstructionElementColor->onSave(); ui->FullyConstraintInternalAlignmentColor->onSave(); - ui->FullyConstraintConstructionPointColor->onSave(); ui->ConstrainedColor->onSave(); ui->NonDrivingConstraintColor->onSave(); @@ -574,7 +572,6 @@ void SketcherSettingsAppearance::loadSettings() ui->SketchEdgeColor->onRestore(); ui->SketchVertexColor->onRestore(); ui->EditedEdgeColor->onRestore(); - ui->EditedVertexColor->onRestore(); ui->ConstructionColor->onRestore(); ui->ExternalColor->onRestore(); ui->InvalidSketchColor->onRestore(); @@ -583,7 +580,6 @@ void SketcherSettingsAppearance::loadSettings() ui->FullyConstraintElementColor->onRestore(); ui->FullyConstraintConstructionElementColor->onRestore(); ui->FullyConstraintInternalAlignmentColor->onRestore(); - ui->FullyConstraintConstructionPointColor->onRestore(); ui->ConstrainedColor->onRestore(); ui->NonDrivingConstraintColor->onRestore(); diff --git a/src/Mod/Sketcher/Gui/SketcherSettingsAppearance.ui b/src/Mod/Sketcher/Gui/SketcherSettingsAppearance.ui index 576bef1aba..09e9a5b7a4 100644 --- a/src/Mod/Sketcher/Gui/SketcherSettingsAppearance.ui +++ b/src/Mod/Sketcher/Gui/SketcherSettingsAppearance.ui @@ -193,69 +193,10 @@ - - - - Vertex - - - - - - - - 0 - 0 - - - - Color of fully constrained vertex color in edit mode - - - - 255 - 149 - 128 - - - - FullyConstraintConstructionPointColor - - - View - - - - - - - - 0 - 0 - - - - Color of vertices being edited - - - - 255 - 38 - 0 - - - - EditedVertexColor - - - View - - - - Edge + Geometry