Sketcher: Points color reflect their construction state. Remove Vertex color.

This commit is contained in:
PaddleStroke
2024-03-22 13:38:14 +01:00
committed by Yorik van Havre
parent 81fcfa1dbe
commit f5da655429
8 changed files with 38 additions and 89 deletions

View File

@@ -7,7 +7,6 @@
<FCUInt Name="SketchEdgeColor" Value="4294967295"/>
<FCUInt Name="SketchVertexColor" Value="4294967295"/>
<FCUInt Name="EditedEdgeColor" Value="4294967295"/>
<FCUInt Name="EditedVertexColor" Value="4280680703"/>
<FCUInt Name="ConstructionColor" Value="56575"/>
<FCUInt Name="ExternalColor" Value="3425924095"/>
<FCUInt Name="InvalidSketchColor" Value="4285333759"/>
@@ -16,7 +15,6 @@
<FCUInt Name="FullyConstraintElementColor" Value="2161156351"/>
<FCUInt Name="FullyConstraintConstructionElementColor" Value="2410282495"/>
<FCUInt Name="FullyConstraintInternalAlignmentColor" Value="3739142399"/>
<FCUInt Name="FullyConstraintConstructionPointColor" Value="4287987967"/>
<FCUInt Name="ConstrainedIcoColor" Value="4280680703"/>
<FCUInt Name="NonDrivingConstrDimColor" Value="2555903"/>
<FCUInt Name="ConstrainedDimColor" Value="4280680703"/>

View File

@@ -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);

View File

@@ -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)

View File

@@ -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<std::vector<std::vector<int>>>
CurvIdToGeoId; // conversion of SoLineSet index to GeoId
std::vector<std::vector<int>> PointIdToGeoId; // conversion of SoCoordinate3 index to GeoId
std::vector<std::vector<Sketcher::PointPos>> 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 */

View File

@@ -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++);
}

View File

@@ -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

View File

@@ -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();

View File

@@ -193,69 +193,10 @@
</property>
</spacer>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Vertex</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="Gui::PrefColorButton" name="FullyConstraintConstructionPointColor">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Color of fully constrained vertex color in edit mode</string>
</property>
<property name="color" stdset="0">
<color>
<red>255</red>
<green>149</green>
<blue>128</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>FullyConstraintConstructionPointColor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="Gui::PrefColorButton" name="EditedVertexColor">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Color of vertices being edited</string>
</property>
<property name="color" stdset="0">
<color>
<red>255</red>
<green>38</green>
<blue>0</blue>
</color>
</property>
<property name="prefEntry" stdset="0">
<cstring>EditedVertexColor</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>View</cstring>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Edge</string>
<string>Geometry</string>
</property>
</widget>
</item>