[Bf-blender-cvs] [4045b3d7b68] master: GPencil: Fix offset modifier negative scale thickness

Henrik Dick noreply at git.blender.org
Mon Mar 14 11:14:27 CET 2022


Commit: 4045b3d7b685aeeb6003d3f90b4a41f6337b6159
Author: Henrik Dick
Date:   Mon Mar 14 11:11:22 2022 +0100
Branches: master
https://developer.blender.org/rB4045b3d7b685aeeb6003d3f90b4a41f6337b6159

GPencil: Fix offset modifier negative scale thickness

If the scale in the offset modifier was set to a value lower than -1,
the object would get mirrored. The problem was, that the thickness
was set to 0 by that. This fix makes the thickness calculation only
use the absolute values.

Differential Revision: http://developer.blender.org/D14324

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

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

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

diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c b/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c
index 3aaa032ef70..95c3f2c161f 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c
@@ -152,7 +152,7 @@ static void deformStroke(GpencilModifierData *md,
     loc_eul_size_to_mat4(mat, loc, rot, scale);
 
     /* Apply scale to thickness. */
-    float unit_scale = (scale[0] + scale[1] + scale[2]) / 3.0f;
+    float unit_scale = (fabsf(scale[0]) + fabsf(scale[1]) + fabsf(scale[2])) / 3.0f;
     pt->pressure *= unit_scale;
 
     mul_m4_v3(mat, &pt->x);



More information about the Bf-blender-cvs mailing list