[Bf-blender-cvs] [a0b0a47d810] master: GPencil: Scale stroke thickness when use Offset modifier scale

Antonio Vazquez noreply at git.blender.org
Mon Jul 27 19:09:49 CEST 2020


Commit: a0b0a47d8104e6c0ef56745c713ea7f7a34099ce
Author: Antonio Vazquez
Date:   Mon Jul 27 19:09:32 2020 +0200
Branches: master
https://developer.blender.org/rBa0b0a47d8104e6c0ef56745c713ea7f7a34099ce

GPencil: Scale stroke thickness when use  Offset modifier scale

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

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 9cc3712e8f4..75f929e979e 100644
--- a/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c
+++ b/source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c
@@ -105,19 +105,23 @@ static void deformStroke(GpencilModifierData *md,
     bGPDspoint *pt = &gps->points[i];
     MDeformVert *dvert = gps->dvert != NULL ? &gps->dvert[i] : NULL;
 
-    /* verify vertex group */
+    /* Verify vertex group. */
     const float weight = get_modifier_point_weight(
         dvert, (mmd->flag & GP_OFFSET_INVERT_VGROUP) != 0, def_nr);
     if (weight < 0.0f) {
       continue;
     }
-    /* calculate matrix */
+    /* Calculate matrix. */
     mul_v3_v3fl(loc, mmd->loc, weight);
     mul_v3_v3fl(rot, mmd->rot, weight);
     mul_v3_v3fl(scale, mmd->scale, weight);
     add_v3_fl(scale, 1.0);
     loc_eul_size_to_mat4(mat, loc, rot, scale);
 
+    /* Apply scale to thickness. */
+    float unit_scale = (scale[0] + scale[1] + scale[2]) / 3.0f;
+    pt->pressure *= unit_scale;
+
     mul_m4_v3(mat, &pt->x);
   }
   /* Calc geometry data. */



More information about the Bf-blender-cvs mailing list