Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Vazquez <blendergit@gmail.com>2016-04-28 16:10:33 +0300
committerJoshua Leung <aligorith@gmail.com>2016-05-08 15:53:47 +0300
commit1d5c71bca74fe3bef40446259d424380f237c27f (patch)
tree7621cb32fdc803838494d48bfa167c4ce3f7ae3c /source/blender/blenkernel
parent0411cfea9d8bfcad6271ccec51bc9a9c641c798c (diff)
D1705: Fix Grease Pencil Fill for Concave Shapes
Improve filling for concave shapes using a triangulation of the stroke. The triangulation information is saved in an internal cache and only is recalculated if the stroke changes. The triangulation is not saved in .blend file. Reviewers: aligorith Maniphest Tasks: T47102 Differential Revision: https://developer.blender.org/D1705
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/gpencil.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 485c4f5b29f..c23429d86b7 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -68,6 +68,7 @@ bool free_gpencil_strokes(bGPDframe *gpf)
/* free stroke memory arrays, then stroke itself */
if (gps->points) MEM_freeN(gps->points);
+ if (gps->triangles) MEM_freeN(gps->triangles);
BLI_freelinkN(&gpf->strokes, gps);
}
@@ -261,7 +262,9 @@ bGPDlayer *gpencil_layer_addnew(bGPdata *gpd, const char *name, bool setactive)
ARRAY_SET_ITEMS(gpl->gcolor_prev, 0.145098f, 0.419608f, 0.137255f); /* green */
ARRAY_SET_ITEMS(gpl->gcolor_next, 0.125490f, 0.082353f, 0.529412f); /* blue */
-
+ /* HQ fill by default */
+ gpl->flag |= GP_LAYER_HQ_FILL;
+
/* auto-name */
BLI_strncpy(gpl->info, name, sizeof(gpl->info));
BLI_uniquename(&gpd->layers, gpl, DATA_("GP_Layer"), '.', offsetof(bGPDlayer, info), sizeof(gpl->info));
@@ -315,7 +318,8 @@ bGPDframe *gpencil_frame_duplicate(bGPDframe *src)
/* make copy of source stroke, then adjust pointer to points too */
gpsd = MEM_dupallocN(gps);
gpsd->points = MEM_dupallocN(gps->points);
-
+ gpsd->triangles = MEM_dupallocN(gps->triangles);
+ gpsd->flag |= GP_STROKE_RECALC_CACHES;
BLI_addtail(&dst->strokes, gpsd);
}
@@ -424,6 +428,7 @@ void gpencil_frame_delete_laststroke(bGPDlayer *gpl, bGPDframe *gpf)
/* free the stroke and its data */
MEM_freeN(gps->points);
+ MEM_freeN(gps->triangles);
BLI_freelinkN(&gpf->strokes, gps);
/* if frame has no strokes after this, delete it */