Skip to content

Commit

Permalink
+ fixes #1790: Crash on undo/redo with a selection
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Dec 13, 2014
1 parent ff7e33b commit 78f07f8
Showing 1 changed file with 41 additions and 34 deletions.
75 changes: 41 additions & 34 deletions src/Mod/Sketcher/Gui/ViewProviderSketch.cpp
Expand Up @@ -1957,22 +1957,29 @@ void ViewProviderSketch::updateColor(void)
//int32_t *index = edit->CurveSet->numVertices.startEditing();

// colors of the point set
if (edit->FullyConstrained)
if (edit->FullyConstrained) {
for (int i=0; i < PtNum; i++)
pcolor[i] = FullyConstrainedColor;
else
}
else {
for (int i=0; i < PtNum; i++)
pcolor[i] = VertexColor;
}

if (edit->PreselectCross == 0)
if (edit->PreselectCross == 0) {
pcolor[0] = PreselectColor;
else if (edit->PreselectPoint != -1)
pcolor[edit->PreselectPoint + 1] = PreselectColor;
}
else if (edit->PreselectPoint != -1) {
if (edit->PreselectPoint + 1 < PtNum)
pcolor[edit->PreselectPoint + 1] = PreselectColor;
}

for (std::set<int>::iterator it=edit->SelPointSet.begin();
it != edit->SelPointSet.end(); it++)
pcolor[*it] = (*it==(edit->PreselectPoint + 1) && (edit->PreselectPoint != -1))?
PreselectSelectedColor:SelectColor;
for (std::set<int>::iterator it = edit->SelPointSet.begin(); it != edit->SelPointSet.end(); ++it) {
if (*it < PtNum) {
pcolor[*it] = (*it==(edit->PreselectPoint + 1) && (edit->PreselectPoint != -1))
? PreselectSelectedColor : SelectColor;
}
}

// colors of the curves
//int intGeoCount = getSketchObject()->getHighestCurveIndex() + 1;
Expand All @@ -1986,58 +1993,58 @@ void ViewProviderSketch::updateColor(void)
int GeoId = edit->CurvIdToGeoId[i];
// CurvId has several vertex a ssociated to 1 material
//edit->CurveSet->numVertices => [i] indicates number of vertex for line i.
int indexes=(edit->CurveSet->numVertices[i]);
int indexes = (edit->CurveSet->numVertices[i]);

bool selected=(edit->SelCurvSet.find(GeoId) != edit->SelCurvSet.end());
bool preselected=(edit->PreselectCurve == GeoId);
bool selected = (edit->SelCurvSet.find(GeoId) != edit->SelCurvSet.end());
bool preselected = (edit->PreselectCurve == GeoId);

if (selected && preselected){
if (selected && preselected) {
color[i] = PreselectSelectedColor;
for(int k=j; j<k+indexes; j++){
verts[j].getValue(x,y,z);
verts[j]=SbVec3f(x,y,zHighLine);
for (int k=j; j<k+indexes; j++) {
verts[j].getValue(x,y,z);
verts[j] = SbVec3f(x,y,zHighLine);
}
}
else if (selected){
color[i] = SelectColor;
for(int k=j; j<k+indexes; j++){
verts[j].getValue(x,y,z);
verts[j]=SbVec3f(x,y,zHighLine);
for (int k=j; j<k+indexes; j++) {
verts[j].getValue(x,y,z);
verts[j] = SbVec3f(x,y,zHighLine);
}
}
else if (preselected){
color[i] = PreselectColor;
for(int k=j; j<k+indexes; j++){
verts[j].getValue(x,y,z);
verts[j]=SbVec3f(x,y,zHighLine);
for (int k=j; j<k+indexes; j++) {
verts[j].getValue(x,y,z);
verts[j] = SbVec3f(x,y,zHighLine);
}
}
else if (GeoId < -2) { // external Geometry
color[i] = CurveExternalColor;
for(int k=j; j<k+indexes; j++){
verts[j].getValue(x,y,z);
verts[j]=SbVec3f(x,y,zConstr);
for (int k=j; j<k+indexes; j++) {
verts[j].getValue(x,y,z);
verts[j] = SbVec3f(x,y,zConstr);
}
}
else if (getSketchObject()->getGeometry(GeoId)->Construction) {
color[i] = CurveDraftColor;
for(int k=j; j<k+indexes; j++){
verts[j].getValue(x,y,z);
verts[j]=SbVec3f(x,y,zLines);
for (int k=j; j<k+indexes; j++) {
verts[j].getValue(x,y,z);
verts[j] = SbVec3f(x,y,zLines);
}
}
else if (edit->FullyConstrained) {
color[i] = FullyConstrainedColor;
for(int k=j; j<k+indexes; j++){
verts[j].getValue(x,y,z);
verts[j]=SbVec3f(x,y,zLines);
for (int k=j; j<k+indexes; j++) {
verts[j].getValue(x,y,z);
verts[j] = SbVec3f(x,y,zLines);
}
}
else {
color[i] = CurveColor;
for(int k=j; j<k+indexes; j++){
verts[j].getValue(x,y,z);
verts[j]=SbVec3f(x,y,zLines);
for (int k=j; j<k+indexes; j++) {
verts[j].getValue(x,y,z);
verts[j] = SbVec3f(x,y,zLines);
}
}
}
Expand Down

0 comments on commit 78f07f8

Please sign in to comment.