Fix for D1705: Update to fix the bug with extra triangles that produces glitches in some situations
This commit is contained in:
parent
011786a3f8
commit
dc78e47b77
@ -389,7 +389,7 @@ static void gp_triangulate_stroke_fill(bGPDstroke *gps)
|
||||
gp_stroke_2d_flat(gps->points, gps->totpoints, points2d, &direction);
|
||||
BLI_polyfill_calc((const float(*)[2])points2d, (unsigned int)gps->totpoints, direction, (unsigned int(*)[3])tmp_triangles);
|
||||
|
||||
/* count number of valid triangles */
|
||||
/* count number of valid triangles, slower but safer */
|
||||
gps->tot_triangles = 0;
|
||||
for (int i = 0; i < gps->totpoints; i++) {
|
||||
if ((tmp_triangles[i][0] >= 0) && (tmp_triangles[i][0] < gps->totpoints) &&
|
||||
@ -399,6 +399,11 @@ static void gp_triangulate_stroke_fill(bGPDstroke *gps)
|
||||
gps->tot_triangles++;
|
||||
}
|
||||
}
|
||||
|
||||
if (gps->tot_triangles > gps->totpoints - 2) {
|
||||
/* avoid problems with extra (unwanted) triangles getting created */
|
||||
gps->tot_triangles = gps->totpoints - 2;
|
||||
}
|
||||
//printf("tot triangles: %d / %d - direction = %d\n", gps->tot_triangles, gps->totpoints, direction);
|
||||
|
||||
/* save triangulation data in stroke cache */
|
||||
|
Loading…
Reference in New Issue
Block a user