[Bf-blender-cvs] [4928fc93b6b] greasepencil-object: GPencil: Fix random pressure when pressure switch is disabled

Antonio Vazquez noreply at git.blender.org
Wed Apr 22 19:48:45 CEST 2020


Commit: 4928fc93b6bb85a01cc63ad14cb43a26ac307edd
Author: Antonio Vazquez
Date:   Wed Apr 22 19:48:36 2020 +0200
Branches: greasepencil-object
https://developer.blender.org/rB4928fc93b6bb85a01cc63ad14cb43a26ac307edd

GPencil: Fix random pressure when pressure switch is disabled

The random curve must use the pressure all the times.

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

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

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

diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 7e76f5ed1c2..2ceb4f32052 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -772,7 +772,6 @@ static short gp_stroke_addpoint(tGPsdata *p, const float mval[2], float pressure
   tGPspoint *pt;
   Object *obact = (Object *)p->ownerPtr.data;
   RegionView3D *rv3d = p->region->regiondata;
-  p->random_settings.pen_press = pressure;
 
   /* check painting mode */
   if (p->paintmode == GP_PAINTMODE_DRAW_STRAIGHT) {
@@ -2763,6 +2762,8 @@ static void gpencil_draw_apply_event(bContext *C,
 
   /* handle pressure sensitivity (which is supplied by tablets or otherwise 1.0) */
   p->pressure = event->tablet.pressure;
+  /* By default use pen pressure for random curves. */
+  p->random_settings.pen_press = p->pressure;
 
   /* Hack for pressure sensitive eraser on D+RMB when using a tablet:
    * The pen has to float over the tablet surface, resulting in
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index add08308bad..0952063a4ae 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -2788,7 +2788,7 @@ static void gpencil_sbuffer_vertex_color_random(
       /* Apply random curve. */
       if (brush_settings->flag2 & GP_BRUSH_USE_HUE_RAND_PRESS) {
         factor_value[0] *= BKE_curvemapping_evaluateF(
-            brush_settings->curve_rand_hue, 0, tpt->strength);
+            brush_settings->curve_rand_hue, 0, pen_pressure);
       }
     }
 
@@ -2805,7 +2805,7 @@ static void gpencil_sbuffer_vertex_color_random(
       /* Apply random curve. */
       if (brush_settings->flag2 & GP_BRUSH_USE_SAT_RAND_PRESS) {
         factor_value[1] *= BKE_curvemapping_evaluateF(
-            brush_settings->curve_rand_saturation, 0, tpt->strength);
+            brush_settings->curve_rand_saturation, 0, pen_pressure);
       }
     }
 
@@ -2822,7 +2822,7 @@ static void gpencil_sbuffer_vertex_color_random(
       /* Apply random curve. */
       if (brush_settings->flag2 & GP_BRUSH_USE_VAL_RAND_PRESS) {
         factor_value[2] *= BKE_curvemapping_evaluateF(
-            brush_settings->curve_rand_value, 0, tpt->strength);
+            brush_settings->curve_rand_value, 0, pen_pressure);
       }
     }



More information about the Bf-blender-cvs mailing list