Fix T79772: Gpencil. Additive drawing doesn't work when creating fills master
authorAntonio Vazquez <blendergit@gmail.com>
Fri, 14 Aug 2020 17:04:53 +0000 (19:04 +0200)
committerAntonio Vazquez <blendergit@gmail.com>
Fri, 14 Aug 2020 17:05:05 +0000 (19:05 +0200)
This option was not supported in Fill tool

source/blender/editors/gpencil/gpencil_fill.c

index 2855f2cc0d7454ca5832040cf44331f2dd3cce98..9d99773348bd8fd9ce6d849a4974901a13d8c9bd 100644 (file)
@@ -237,6 +237,7 @@ static void gpencil_draw_datablock(tGPDfill *tgpf, const float ink[4])
   bGPdata *gpd = tgpf->gpd;
   Brush *brush = tgpf->brush;
   BrushGpencilSettings *brush_settings = brush->gpencil_settings;
+  ToolSettings *ts = tgpf->scene->toolsettings;
 
   tGPDdraw tgpw;
   tgpw.rv3d = tgpf->rv3d;
@@ -309,7 +310,14 @@ static void gpencil_draw_datablock(tGPDfill *tgpf, const float ink[4])
     /* if active layer and no keyframe, create a new one */
     if (gpl == tgpf->gpl) {
       if ((gpl->actframe == NULL) || (gpl->actframe->framenum != tgpf->active_cfra)) {
-        BKE_gpencil_layer_frame_get(gpl, tgpf->active_cfra, GP_GETFRAME_ADD_NEW);
+        short add_frame_mode;
+        if (ts->gpencil_flags & GP_TOOL_FLAG_RETAIN_LAST) {
+          add_frame_mode = GP_GETFRAME_ADD_COPY;
+        }
+        else {
+          add_frame_mode = GP_GETFRAME_ADD_NEW;
+        }
+        BKE_gpencil_layer_frame_get(gpl, tgpf->active_cfra, add_frame_mode);
       }
     }