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

If the stroke is totally straight, the normal was not calculated properly.
This commit is contained in:
Antonio Vazquez 2020-05-23 15:25:54 +02:00
parent e8dd8c2829
commit b4613e0bca
Notes: blender-bot 2023-06-12 00:52:52 +02:00
Referenced by issue #76995, GPencil: Noise Modifier does not work on straight line along axis.
1 changed files with 4 additions and 1 deletions

View File

@ -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);