[Bf-blender-cvs] [dc78e47] master: Fix for D1705: Update to fix the bug with extra triangles that produces glitches in some situations
Antonio Vazquez
noreply at git.blender.org
Sun May 8 15:11:27 CEST 2016
Commit: dc78e47b770b33645f3cda1a4750422cd5105d6b
Author: Antonio Vazquez
Date: Sat May 7 23:40:59 2016 +1200
Branches: master
https://developer.blender.org/rBdc78e47b770b33645f3cda1a4750422cd5105d6b
Fix for D1705: Update to fix the bug with extra triangles that produces glitches in some situations
===================================================================
M source/blender/editors/gpencil/drawgpencil.c
===================================================================
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index a2ddbca..6ccbd27 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -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 */
More information about the Bf-blender-cvs
mailing list