[Bf-blender-cvs] [b4613e0bca9] blender-v2.83-release: GPencil: Fix unreported Noise modifier does not work in axis aligned strokes

Antonio Vazquez noreply at git.blender.org
Sat May 23 15:26:08 CEST 2020


Commit: b4613e0bca9ba3999f1198f84257a763167c6a15
Author: Antonio Vazquez
Date:   Sat May 23 15:25:54 2020 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rBb4613e0bca9ba3999f1198f84257a763167c6a15

GPencil: Fix unreported Noise modifier does not work in axis aligned strokes

If the stroke is totally straight, the normal was not calculated properly.

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

M	source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c

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

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
index 5ed08e39197..04a17336a90 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilnoise.c
@@ -170,9 +170,12 @@ static void deformStroke(GpencilModifierData *md,
   float *noise_table_thickness = (mmd->factor_thickness > 0.0f) ? noise_table(len, seed) : NULL;
   float *noise_table_uvs = (mmd->factor_uvs > 0.0f) ? noise_table(len, seed + 4) : NULL;
 
-  /* calculate stroke normal*/
+  /* Calculate stroke normal. */
   if (gps->totpoints > 2) {
     BKE_gpencil_stroke_normal(gps, normal);
+    if (is_zero_v3(normal)) {
+    copy_v3_fl(normal, 1.0f);
+    }
   }
   else {
     copy_v3_fl(normal, 1.0f);



More information about the Bf-blender-cvs mailing list