[Bf-blender-cvs] [c0fdaf700a5] master: Fix the GPencil stroke not sticking to other strokes

Germano Cavalcante noreply at git.blender.org
Wed Nov 3 22:52:19 CET 2021


Commit: c0fdaf700a51cf15281abfb21488513f37504f75
Author: Germano Cavalcante
Date:   Wed Nov 3 18:51:25 2021 -0300
Branches: master
https://developer.blender.org/rBc0fdaf700a51cf15281abfb21488513f37504f75

Fix the GPencil stroke not sticking to other strokes

Issue seen when setting `Stroke Placement` of type `Stroke`.

Regression introduced in {rBaa0ac0035a0d3601672a0c732e3f8f932a36fc04}.

===================================================================

M	source/blender/editors/gpencil/gpencil_paint.c

===================================================================

diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index f37f2cd549f..8d72ea72532 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -2277,8 +2277,9 @@ static void gpencil_paint_initstroke(tGPsdata *p,
 static void gpencil_paint_strokeend(tGPsdata *p)
 {
   ToolSettings *ts = p->scene->toolsettings;
-  /* for surface sketching, need to set the right OpenGL context stuff so that
-   * the conversions will project the values correctly...
+  const bool is_eraser = (p->gpd->runtime.sbuffer_sflag & GP_STROKE_ERASER) != 0;
+  /* for surface sketching, need to set the right OpenGL context stuff so
+   * that the conversions will project the values correctly...
    */
   if (gpencil_project_check(p)) {
     View3D *v3d = p->area->spacedata.first;
@@ -2292,11 +2293,11 @@ static void gpencil_paint_strokeend(tGPsdata *p)
                              (ts->gpencil_v3d_align & GP_PROJECT_DEPTH_STROKE) ?
                                  V3D_DEPTH_GPENCIL_ONLY :
                                  V3D_DEPTH_NO_GPENCIL,
-                             NULL);
+                             is_eraser ? NULL : &p->depths);
   }
 
   /* check if doing eraser or not */
-  if ((p->gpd->runtime.sbuffer_sflag & GP_STROKE_ERASER) == 0) {
+  if (!is_eraser) {
     /* transfer stroke to frame */
     gpencil_stroke_newfrombuffer(p);
   }



More information about the Bf-blender-cvs mailing list