GPencil: Scale stroke thickness when use Offset modifier scale

This commit is contained in:
Antonio Vazquez 2020-07-27 19:09:32 +02:00
parent e8869d9c71
commit a0b0a47d81
1 changed files with 6 additions and 2 deletions

View File

@ -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. */