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:
authorHenrik Dick <hen-di@web.de>2022-05-02 23:13:38 +0300
committerHenrik Dick <hen-di@web.de>2022-05-02 23:13:38 +0300
commit62ef1c08af9a62104201e062f2b9a374c056e53b (patch)
treef9a246bff1e137a781ec2dd80b91f774aa39f011 /source/blender/gpencil_modifiers/intern
parent5188c14718c56e4d088d3c5bb3ce3ed9ed8b7bdc (diff)
GPencil: Fix envelope modifier deform mode thickness
The thickness in the deform mode was just correct if the radius when drawing a stroke was set to 20. Now all factors that influence the stroke thickness are considered in deform mode. Differential Revision: https://developer.blender.org/D14691
Diffstat (limited to 'source/blender/gpencil_modifiers/intern')
-rw-r--r--source/blender/gpencil_modifiers/intern/MOD_gpencilenvelope.c22
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,