Fix #26059: select_vertex_path fails when vertices aren't selected 1 by 1 in gui

Cicrcle and border selection doesn't add entry to EditSelection. Use cycle
through vertices rather than EditSelection stack to find two selected vertices.

No slowdown for case two vertices are selected (use this cycle to clear temporary
flag too), minor slowdown for unsupported selections.
This commit is contained in:
Sergey Sharybin
2011-02-13 10:25:12 +00:00
parent 90f543ba3a
commit 9ac8c5315e

View File

@@ -5984,7 +5984,6 @@ static int select_vertex_path_exec(bContext *C, wmOperator *op)
EditMesh *em= BKE_mesh_get_editmesh((Mesh *)obedit->data);
EditVert *eve, *s, *t;
EditEdge *eed;
EditSelection *ese;
PathEdge *newpe, *currpe;
PathNode *currpn;
PathNode *Q;
@@ -5995,17 +5994,24 @@ static int select_vertex_path_exec(bContext *C, wmOperator *op)
Heap *heap; /*binary heap for sorting pointers to PathNodes based upon a 'cost'*/
s = t = NULL;
for(eve=em->verts.first; eve; eve=eve->next) {
if(eve->f&SELECT) {
if(s == NULL) s= eve;
else if(t == NULL) t= eve;
else {
/* more than two vertices are selected,
show warning message and cancel operator */
s = t = NULL;
break;
}
ese = ((EditSelection*)em->selected.last);
if(ese && ese->type == EDITVERT && ese->prev && ese->prev->type == EDITVERT) {
t = (EditVert*)ese->data;
s = (EditVert*)ese->prev->data;
/*need to find out if t is actually reachable by s....*/
for(eve=em->verts.first; eve; eve=eve->next){
eve->f1 = 0;
}
/*need to find out if t is actually reachable by s....*/
eve->f1 = 0;
}
if(s != NULL && t != NULL) {
s->f1 = 1;
unbalanced = 1;