[Bf-blender-cvs] [dda3e483036] greasepencil-object: GPencil: Copy Brusg gradient data to stroke in drawing operators.

Antonioya noreply at git.blender.org
Tue Mar 19 14:07:40 CET 2019


Commit: dda3e483036458adc68dda8ab8655c426d168fb7
Author: Antonioya
Date:   Mon Mar 18 10:29:13 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rBdda3e483036458adc68dda8ab8655c426d168fb7

GPencil: Copy Brusg gradient data to stroke in drawing operators.

===================================================================

M	source/blender/editors/gpencil/annotate_paint.c
M	source/blender/editors/gpencil/gpencil_fill.c
M	source/blender/editors/gpencil/gpencil_merge.c
M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/editors/gpencil/gpencil_primitive.c

===================================================================

diff --git a/source/blender/editors/gpencil/annotate_paint.c b/source/blender/editors/gpencil/annotate_paint.c
index 349deb6b53e..c61ee7be6ac 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 36202bdac0a..5a73f2e2d77 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -1012,6 +1012,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 40f0c0e7b84..09df45f75ca 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -938,6 +938,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 962442824f9..fd30fc8ba68 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -338,6 +338,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 */
@@ -1216,6 +1219,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);
@@ -1238,7 +1242,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;



More information about the Bf-blender-cvs mailing list