Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Vazquez <blendergit@gmail.com>2020-07-27 20:09:32 +0300
committerAntonio Vazquez <blendergit@gmail.com>2020-07-27 20:09:44 +0300
commita0b0a47d8104e6c0ef56745c713ea7f7a34099ce (patch)
treeb73d952949942ca725bfd22e5c9e518a74b71826 /source/blender/gpencil_modifiers
parente8869d9c7110f17c5fed6929410273d8a8105808 (diff)
GPencil: Scale stroke thickness when use Offset modifier scale
Diffstat (limited to 'source/blender/gpencil_modifiers')
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpenciloffset.c8
1 files changed, 6 insertions, 2 deletions
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. */