diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2020-03-09 18:27:24 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2020-03-09 18:27:24 +0300 |
commit | 29f3af95272590d26f610ae828b2eeee89c82a00 (patch) | |
tree | a696a58a2561c48f7ec6166e369e22081e0a64d8 /source/blender/editors/gpencil/annotate_draw.c | |
parent | dcb93126876879d969a30a7865700abd072066f8 (diff) |
GPencil: Refactor of Draw Engine, Vertex Paint and all internal functions
This commit is a full refactor of the grease pencil modules including Draw Engine, Modifiers, VFX, depsgraph update, improvements in operators and conversion of Sculpt and Weight paint tools to real brushes.
Also, a huge code cleanup has been done at all levels.
Thanks to @fclem for his work and yo @pepeland and @mendio for the testing and help in the development.
Differential Revision: https://developer.blender.org/D6293
Diffstat (limited to 'source/blender/editors/gpencil/annotate_draw.c')
-rw-r--r-- | source/blender/editors/gpencil/annotate_draw.c | 37 |
1 files changed, 11 insertions, 26 deletions
diff --git a/source/blender/editors/gpencil/annotate_draw.c b/source/blender/editors/gpencil/annotate_draw.c index 1a30555a584..ef9b6d2943b 100644 --- a/source/blender/editors/gpencil/annotate_draw.c +++ b/source/blender/editors/gpencil/annotate_draw.c @@ -33,6 +33,7 @@ #include "BLI_sys_types.h" #include "BLI_math.h" +#include "BLI_listbase.h" #include "BLI_utildefines.h" #include "BLF_api.h" @@ -562,7 +563,7 @@ static void annotation_draw_strokes(bGPdata *UNUSED(gpd), { GPU_program_point_size(true); - for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) { + LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { /* check if stroke can be drawn */ if (annotation_can_draw_stroke(gps, dflag) == false) { continue; @@ -625,7 +626,7 @@ static void annotation_draw_strokes(bGPdata *UNUSED(gpd), } /* Draw selected verts for strokes being edited */ -static void annotation_draw_strokes_edit(bGPdata *gpd, +static void annotation_draw_strokes_edit(bGPdata *UNUSED(gpd), bGPDlayer *gpl, const bGPDframe *gpf, int offsx, @@ -660,7 +661,7 @@ static void annotation_draw_strokes_edit(bGPdata *gpd, GPU_program_point_size(true); /* draw stroke verts */ - for (bGPDstroke *gps = gpf->strokes.first; gps; gps = gps->next) { + LISTBASE_FOREACH (bGPDstroke *, gps, &gpf->strokes) { /* check if stroke can be drawn */ if (annotation_can_draw_stroke(gps, dflag) == false) { continue; @@ -689,6 +690,9 @@ static void annotation_draw_strokes_edit(bGPdata *gpd, vsize = bsize + 2; } + /* Why? */ + UNUSED_VARS(vsize); + float selectColor[4]; UI_GetThemeColor3fv(TH_GP_VERTEX_SELECT, selectColor); selectColor[3] = alpha; @@ -709,31 +713,12 @@ static void annotation_draw_strokes_edit(bGPdata *gpd, immBegin(GPU_PRIM_POINTS, gps->totpoints); - /* Draw start and end point differently if enabled stroke direction hint */ - bool show_direction_hint = (gpd->flag & GP_DATA_SHOW_DIRECTION) && (gps->totpoints > 1); - /* Draw all the stroke points (selected or not) */ bGPDspoint *pt = gps->points; for (int i = 0; i < gps->totpoints; i++, pt++) { /* size and color first */ - if (show_direction_hint && i == 0) { - /* start point in green bigger */ - immAttr3f(color, 0.0f, 1.0f, 0.0f); - immAttr1f(size, vsize + 4); - } - else if (show_direction_hint && (i == gps->totpoints - 1)) { - /* end point in red smaller */ - immAttr3f(color, 1.0f, 0.0f, 0.0f); - immAttr1f(size, vsize + 1); - } - else if (pt->flag & GP_SPOINT_SELECT) { - immAttr3fv(color, selectColor); - immAttr1f(size, vsize); - } - else { - immAttr3fv(color, gpl->color); - immAttr1f(size, bsize); - } + immAttr3fv(color, gpl->color); + immAttr1f(size, bsize); /* then position */ if (gps->flag & GP_STROKE_3DSPACE) { @@ -857,7 +842,7 @@ static void annotation_draw_data_layers( { float ink[4]; - for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) { + LISTBASE_FOREACH (bGPDlayer *, gpl, &gpd->layers) { /* verify never thickness is less than 1 */ CLAMP_MIN(gpl->thickness, 1.0f); short lthick = gpl->thickness; @@ -872,7 +857,7 @@ static void annotation_draw_data_layers( } /* get frame to draw */ - bGPDframe *gpf = BKE_gpencil_layer_getframe(gpl, cfra, GP_GETFRAME_USE_PREV); + bGPDframe *gpf = BKE_gpencil_layer_frame_get(gpl, cfra, GP_GETFRAME_USE_PREV); if (gpf == NULL) { continue; } |