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:
authorAntonioya <blendergit@gmail.com>2019-04-15 11:32:06 +0300
committerAntonioya <blendergit@gmail.com>2019-04-15 11:32:25 +0300
commit240940c58ca3ce65e4bbceebea71dd9d1c2c08bc (patch)
tree97a9c60a7c2e059cef2541667ade5e00c70c21f5 /source/blender/editors
parent7c79455297d818a94aab2a9be5807b4d9ca43827 (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/editors')
-rw-r--r--source/blender/editors/gpencil/annotate_paint.c3
-rw-r--r--source/blender/editors/gpencil/gpencil_fill.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_merge.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c2
-rw-r--r--source/blender/editors/gpencil/gpencil_primitive.c9
-rw-r--r--source/blender/editors/space_view3d/view3d_gizmo_ruler.c3
6 files changed, 20 insertions, 1 deletions
diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c
index 5152bcb0a90..dcecd87a862 100644
--- a/source/blender/editors/gpencil/annotate_paint.c
+++ b/source/blender/editors/gpencil/annotate_paint.c
@@ -681,6 +681,9 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
/* copy appropriate settings for stroke */
gps->totpoints = totelem;
gps->thickness = gpl->thickness;
+ gps->gradient_f = 1.0f;
+ gps->gradient_s[0] = 1.0f;
+ gps->gradient_s[1] = 1.0f;
gps->flag = gpd->runtime.sbuffer_sflag;
gps->inittime = p->inittime;
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index e13dfb38c7d..76d15557055 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -1011,6 +1011,8 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf)
/* create new stroke */
bGPDstroke *gps = MEM_callocN(sizeof(bGPDstroke), "bGPDstroke");
gps->thickness = brush->size;
+ gps->gradient_f = brush->gpencil_settings->gradient_f;
+ copy_v2_v2(gps->gradient_s, brush->gpencil_settings->gradient_s);
gps->inittime = 0.0f;
/* the polygon must be closed, so enabled cyclic */
diff --git a/source/blender/editors/gpencil/gpencil_merge.c b/source/blender/editors/gpencil/gpencil_merge.c
index 80b26a366fe..10bf45a9e2f 100644
--- a/source/blender/editors/gpencil/gpencil_merge.c
+++ b/source/blender/editors/gpencil/gpencil_merge.c
@@ -127,6 +127,8 @@ static bGPDstroke *gpencil_prepare_stroke(bContext *C, wmOperator *op, int totpo
gps->totpoints = totpoints;
gps->inittime = 0.0f;
gps->thickness = brush->size;
+ gps->gradient_f = brush->gpencil_settings->gradient_f;
+ copy_v2_v2(gps->gradient_s, brush->gpencil_settings->gradient_s);
gps->flag |= GP_STROKE_SELECT;
gps->flag |= GP_STROKE_3DSPACE;
gps->mat_nr = ob->actcol - 1;
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index daea24ecaa3..aadaff5b7cc 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -944,6 +944,8 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
/* copy appropriate settings for stroke */
gps->totpoints = totelem;
gps->thickness = brush->size;
+ gps->gradient_f = brush->gpencil_settings->gradient_f;
+ copy_v2_v2(gps->gradient_s, brush->gpencil_settings->gradient_s);
gps->flag = gpd->runtime.sbuffer_sflag;
gps->inittime = p->inittime;
diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c
index f92398520fa..374dbbf4d9c 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -319,6 +319,9 @@ static void gp_primitive_set_initdata(bContext *C, tGPDprimitive *tgpi)
/* create new temp stroke */
bGPDstroke *gps = MEM_callocN(sizeof(bGPDstroke), "Temp bGPDstroke");
gps->thickness = 2.0f;
+ gps->gradient_f = 1.0f;
+ gps->gradient_s[0] = 1.0f;
+ gps->gradient_s[1] = 1.0f;
gps->inittime = 0.0f;
/* enable recalculation flag by default */
@@ -1199,6 +1202,7 @@ static void gpencil_primitive_interaction_end(bContext *C, wmOperator *op, wmWin
bGPDstroke *gps;
ToolSettings *ts = tgpi->scene->toolsettings;
+ Brush *brush = tgpi->brush;
const int def_nr = tgpi->ob->actdef - 1;
const bool have_weight = (bool)BLI_findlink(&tgpi->ob->defbase, def_nr);
@@ -1221,7 +1225,10 @@ static void gpencil_primitive_interaction_end(bContext *C, wmOperator *op, wmWin
/* prepare stroke to get transferred */
gps = tgpi->gpf->strokes.first;
if (gps) {
- gps->thickness = tgpi->brush->size;
+ gps->thickness = brush->size;
+ gps->gradient_f = brush->gpencil_settings->gradient_f;
+ copy_v2_v2(gps->gradient_s, brush->gpencil_settings->gradient_s);
+
gps->flag |= GP_STROKE_RECALC_GEOMETRY;
gps->tot_triangles = 0;
diff --git a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
index f8f92d8bef8..253e02ca639 100644
--- a/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_gizmo_ruler.c
@@ -437,6 +437,9 @@ static bool view3d_ruler_to_gpencil(bContext *C, wmGizmoGroup *gzgroup)
}
gps->flag = GP_STROKE_3DSPACE;
gps->thickness = 3;
+ gps->gradient_f = 1.0f;
+ gps->gradient_s[0] = 1.0f;
+ gps->gradient_s[1] = 1.0f;
BLI_addtail(&gpf->strokes, gps);
changed = true;