Cleanup: Simplify mesh to legacy curve logic

Changed `edge->v2` to `endVert` to make it consistent with surrounding code.
Removed the unused `totedges` variable.
Currently `totpoly` is also unused, but is fixed in a separate PR.

Pull Request: https://projects.blender.org/blender/blender/pulls/105870
This commit is contained in:
bonj
2023-03-18 03:49:25 +01:00
committed by Hans Goudey
parent 3eff28a158
commit 740c9204cc

View File

@@ -472,8 +472,6 @@ void BKE_mesh_to_curve_nurblist(const Mesh *me, ListBase *nurblist, const int ed
const Span<MPoly> polys = me->polys();
const Span<MLoop> loops = me->loops();
int totedges = 0;
/* only to detect edge polylines */
int *edge_users;
@@ -497,7 +495,6 @@ void BKE_mesh_to_curve_nurblist(const Mesh *me, ListBase *nurblist, const int ed
edl->edge = &mesh_edges[i];
BLI_addtail(&edges, edl);
totedges++;
}
}
MEM_freeN(edge_users);
@@ -519,7 +516,6 @@ void BKE_mesh_to_curve_nurblist(const Mesh *me, ListBase *nurblist, const int ed
appendPolyLineVert(&polyline, endVert);
totpoly++;
BLI_freelinkN(&edges, edges.last);
totedges--;
while (ok) { /* while connected edges are found... */
EdgeLink *edl = (EdgeLink *)edges.last;
@@ -531,10 +527,9 @@ void BKE_mesh_to_curve_nurblist(const Mesh *me, ListBase *nurblist, const int ed
if (edge->v1 == endVert) {
endVert = edge->v2;
appendPolyLineVert(&polyline, edge->v2);
appendPolyLineVert(&polyline, endVert);
totpoly++;
BLI_freelinkN(&edges, edl);
totedges--;
ok = true;
}
else if (edge->v2 == endVert) {
@@ -542,7 +537,6 @@ void BKE_mesh_to_curve_nurblist(const Mesh *me, ListBase *nurblist, const int ed
appendPolyLineVert(&polyline, endVert);
totpoly++;
BLI_freelinkN(&edges, edl);
totedges--;
ok = true;
}
else if (edge->v1 == startVert) {
@@ -550,7 +544,6 @@ void BKE_mesh_to_curve_nurblist(const Mesh *me, ListBase *nurblist, const int ed
prependPolyLineVert(&polyline, startVert);
totpoly++;
BLI_freelinkN(&edges, edl);
totedges--;
ok = true;
}
else if (edge->v2 == startVert) {
@@ -558,7 +551,6 @@ void BKE_mesh_to_curve_nurblist(const Mesh *me, ListBase *nurblist, const int ed
prependPolyLineVert(&polyline, startVert);
totpoly++;
BLI_freelinkN(&edges, edl);
totedges--;
ok = true;
}