diff options
author | Henrik Dick <hen-di@web.de> | 2022-05-02 23:18:21 +0300 |
---|---|---|
committer | Henrik Dick <hen-di@web.de> | 2022-05-02 23:18:21 +0300 |
commit | fd7384a751b6cbf6f64ecee1427f4ddf4a107f51 (patch) | |
tree | 95cc7c40de06ce6bcb277d209529cc234ea624d7 /source | |
parent | 0d9e22d43ca18d8326aed33fabe3177dcf0663b8 (diff) | |
parent | 62ef1c08af9a62104201e062f2b9a374c056e53b (diff) |
Merge branch 'blender-v3.2-release'
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/gpencil_modifiers/intern/MOD_gpencilenvelope.c | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/source/blender/gpencil_modifiers/intern/MOD_gpencilenvelope.c b/source/blender/gpencil_modifiers/intern/MOD_gpencilenvelope.c index 8b0a6ee84a2..e5604005240 100644 --- a/source/blender/gpencil_modifiers/intern/MOD_gpencilenvelope.c +++ b/source/blender/gpencil_modifiers/intern/MOD_gpencilenvelope.c @@ -152,8 +152,12 @@ static float calc_radius_limit( return radius_limit; } -static void apply_stroke_envelope( - bGPDstroke *gps, int spread, const int def_nr, const bool invert_vg, const float thickness) +static void apply_stroke_envelope(bGPDstroke *gps, + int spread, + const int def_nr, + const bool invert_vg, + const float thickness, + const float pixfactor) { const bool is_cyclic = (gps->flag & GP_STROKE_CYCLIC) != 0; if (is_cyclic) { @@ -282,9 +286,7 @@ static void apply_stroke_envelope( } float fac = use_dist * weight; - /* The 50 is an internal constant for the default pixel size. The result can be messed up if - * #bGPdata.pixfactor is not default, but I think modifiers shouldn't access that. */ - point->pressure += fac * 50.0f * GP_DEFAULT_PIX_FACTOR; + point->pressure += fac * pixfactor; interp_v3_v3v3(&point->x, &point->x, new_center, fac / len_v3v3(closest, closest2)); } @@ -326,8 +328,14 @@ static void deformStroke(GpencilModifierData *md, return; } - apply_stroke_envelope( - gps, mmd->spread, def_nr, (mmd->flag & GP_ENVELOPE_INVERT_VGROUP) != 0, mmd->thickness); + bGPdata *gpd = (bGPdata *)ob->data; + const float pixfactor = 1000.0f / ((gps->thickness + gpl->line_change) * gpd->pixfactor); + apply_stroke_envelope(gps, + mmd->spread, + def_nr, + (mmd->flag & GP_ENVELOPE_INVERT_VGROUP) != 0, + mmd->thickness, + pixfactor); } static void add_stroke(Object *ob, |