diff options
author | Antonioya <blendergit@gmail.com> | 2019-04-15 11:32:06 +0300 |
---|---|---|
committer | Antonioya <blendergit@gmail.com> | 2019-04-15 11:32:25 +0300 |
commit | 240940c58ca3ce65e4bbceebea71dd9d1c2c08bc (patch) | |
tree | 97a9c60a7c2e059cef2541667ade5e00c70c21f5 /source/blender/blenkernel | |
parent | 7c79455297d818a94aab2a9be5807b4d9ca43827 (diff) |
GPencil: New Dots gradient
This commit adds support for drawing Dots strokes with a gradient factor to get artistic effects like watercolor.
Currently, the option is only supported by Dots materials, and in the future will be added to line strokes, but now there is a limitation on drawing engine and we will keep disabled on Line materials.
Also, added the option to align Dots and Boxes strokes textures aligned with the drawing path to get more fluid strokes.
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/brush.c | 28 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/gpencil.c | 4 |
2 files changed, 32 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index ea5605d8ed1..e0bc914dd78 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -304,6 +304,10 @@ void BKE_brush_gpencil_presets(bContext *C) brush->smooth_stroke_radius = SMOOTH_STROKE_RADIUS; brush->smooth_stroke_factor = SMOOTH_STROKE_FACTOR; + brush->gpencil_settings->gradient_f = 1.0f; + brush->gpencil_settings->gradient_s[0] = 1.0f; + brush->gpencil_settings->gradient_s[1] = 1.0f; + /* Pen brush */ brush = BKE_brush_add_gpencil(bmain, ts, "Draw Pen"); deft = brush; /* save default brush */ @@ -336,6 +340,10 @@ void BKE_brush_gpencil_presets(bContext *C) brush->smooth_stroke_radius = SMOOTH_STROKE_RADIUS; brush->smooth_stroke_factor = SMOOTH_STROKE_FACTOR; + brush->gpencil_settings->gradient_f = 1.0f; + brush->gpencil_settings->gradient_s[0] = 1.0f; + brush->gpencil_settings->gradient_s[1] = 1.0f; + /* Ink brush */ brush = BKE_brush_add_gpencil(bmain, ts, "Draw Ink"); brush->size = 60.0f; @@ -365,6 +373,10 @@ void BKE_brush_gpencil_presets(bContext *C) brush->smooth_stroke_radius = SMOOTH_STROKE_RADIUS; brush->smooth_stroke_factor = SMOOTH_STROKE_FACTOR; + brush->gpencil_settings->gradient_f = 1.0f; + brush->gpencil_settings->gradient_s[0] = 1.0f; + brush->gpencil_settings->gradient_s[1] = 1.0f; + /* Curve */ custom_curve = brush->gpencil_settings->curve_sensitivity; curvemapping_set_defaults(custom_curve, 0, 0.0f, 0.0f, 1.0f, 1.0f); @@ -408,6 +420,10 @@ void BKE_brush_gpencil_presets(bContext *C) curvemapping_initialize(custom_curve); brush_gpencil_curvemap_reset(custom_curve->cm, 3, GPCURVE_PRESET_INKNOISE); + brush->gpencil_settings->gradient_f = 1.0f; + brush->gpencil_settings->gradient_s[0] = 1.0f; + brush->gpencil_settings->gradient_s[1] = 1.0f; + /* Block Basic brush */ brush = BKE_brush_add_gpencil(bmain, ts, "Draw Block"); brush->size = 150.0f; @@ -436,6 +452,10 @@ void BKE_brush_gpencil_presets(bContext *C) brush->smooth_stroke_radius = SMOOTH_STROKE_RADIUS; brush->smooth_stroke_factor = SMOOTH_STROKE_FACTOR; + brush->gpencil_settings->gradient_f = 1.0f; + brush->gpencil_settings->gradient_s[0] = 1.0f; + brush->gpencil_settings->gradient_s[1] = 1.0f; + /* Marker brush */ brush = BKE_brush_add_gpencil(bmain, ts, "Draw Marker"); brush->size = 80.0f; @@ -472,6 +492,10 @@ void BKE_brush_gpencil_presets(bContext *C) curvemapping_initialize(custom_curve); brush_gpencil_curvemap_reset(custom_curve->cm, 4, GPCURVE_PRESET_MARKER); + brush->gpencil_settings->gradient_f = 1.0f; + brush->gpencil_settings->gradient_s[0] = 1.0f; + brush->gpencil_settings->gradient_s[1] = 1.0f; + /* Fill brush */ brush = BKE_brush_add_gpencil(bmain, ts, "Fill Area"); brush->size = 1.0f; @@ -495,6 +519,10 @@ void BKE_brush_gpencil_presets(bContext *C) brush->gpencil_settings->draw_strength = 1.0f; + brush->gpencil_settings->gradient_f = 1.0f; + brush->gpencil_settings->gradient_s[0] = 1.0f; + brush->gpencil_settings->gradient_s[1] = 1.0f; + /* Soft Eraser brush */ brush = BKE_brush_add_gpencil(bmain, ts, "Eraser Soft"); brush->size = 30.0f; diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c index c204a8128c1..d47b3f20a28 100644 --- a/source/blender/blenkernel/intern/gpencil.c +++ b/source/blender/blenkernel/intern/gpencil.c @@ -467,6 +467,10 @@ bGPDstroke *BKE_gpencil_add_stroke(bGPDframe *gpf, int mat_idx, int totpoints, s bGPDstroke *gps = MEM_callocN(sizeof(bGPDstroke), "gp_stroke"); gps->thickness = thickness; + gps->gradient_f = 1.0f; + gps->gradient_s[0] = 1.0f; + gps->gradient_s[1] = 1.0f; + gps->inittime = 0; /* enable recalculation flag by default */ |