[Bf-blender-cvs] [af6a5bc0717] greasepencil-object: GPencil: Apply curve radius as pressure for stroke point

Antonioya noreply at git.blender.org
Sun Jul 14 14:35:57 CEST 2019


Commit: af6a5bc07175727f8617b1def033b59816835b0a
Author: Antonioya
Date:   Sun Jul 14 11:04:31 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBaf6a5bc07175727f8617b1def033b59816835b0a

GPencil: Apply curve radius as pressure for stroke point

When convert the curve, the beziert point radius is used to generate the pressure of the grease pencil stroke point and this allows to generate different thickness.

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

M	source/blender/blenkernel/intern/gpencil.c

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

diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index c9bf88de4e1..028b22a8bc4 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -2107,12 +2107,13 @@ static Material *gpencil_add_from_curve_material(Main *bmain,
 }
 
 /* Helper function to create new stroke section */
-static void gpencil_add_new_points(bGPDstroke *gps, float *coord_array, int init, int totpoints)
+static void gpencil_add_new_points(
+    bGPDstroke *gps, float *coord_array, float pressure, int init, int totpoints)
 {
   for (int i = 0; i < totpoints; i++) {
     bGPDspoint *pt = &gps->points[i + init];
     copy_v3_v3(&pt->x, &coord_array[3 * i]);
-    pt->pressure = 1.0f;
+    pt->pressure = pressure;
     pt->strength = 1.0f;
   }
 }
@@ -2276,7 +2277,7 @@ void BKE_gpencil_convert_curve(Main *bmain,
                                         3 * sizeof(float));
         }
         /* Add points to the stroke */
-        gpencil_add_new_points(gps, coord_array, init, resolu);
+        gpencil_add_new_points(gps, coord_array, bezt->radius, init, resolu);
         /* Free memory. */
         MEM_SAFE_FREE(coord_array);



More information about the Bf-blender-cvs mailing list