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>2022-08-31 16:10:13 +0300
committerAntonio Vazquez <blendergit@gmail.com>2022-08-31 17:18:08 +0300
commitae79bc490a761cf351f09514356994d6efd586db (patch)
treed34eef42409c5b16852549b21f4e901d916d33a9 /source/blender/editors/gpencil
parent097ed6565edd27c8178a764fe6dbacb1ba75ef52 (diff)
GPencil: Apply Brush Size to Outline thickness while drawing
The new factor allows to apply the current brush size to the external stroke perimeter conversion done in draw mode.
Diffstat (limited to 'source/blender/editors/gpencil')
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index b196fcae51c..cbc88b57c65 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -943,8 +943,9 @@ static bGPDstroke *gpencil_stroke_to_outline(tGPsdata *p, bGPDstroke *gps)
/* Stroke. */
float diff_mat[4][4];
unit_m4(diff_mat);
+ const float outline_thickness = (float)brush->size * gpencil_settings->outline_fac * 0.5f;
bGPDstroke *gps_perimeter = BKE_gpencil_stroke_perimeter_from_view(
- rv3d, p->gpd, gpl, gps_duplicate, 3, diff_mat, 0.0f);
+ rv3d, p->gpd, gpl, gps_duplicate, 3, diff_mat, outline_thickness);
/* Assign material. */
if (gpencil_settings->material_alt == NULL) {
gps_perimeter->mat_nr = gps->mat_nr;
@@ -961,6 +962,8 @@ static bGPDstroke *gpencil_stroke_to_outline(tGPsdata *p, bGPDstroke *gps)
}
/* Set pressure constant. */
+ gps_perimeter->thickness = max_ii((int)outline_thickness, 1);
+
bGPDspoint *pt;
for (int i = 0; i < gps_perimeter->totpoints; i++) {
pt = &gps_perimeter->points[i];