[Bf-blender-cvs] [aac875421ff] greasepencil-object: GPencil: Fill changes

Charlie Jolly noreply at git.blender.org
Fri Mar 1 14:29:18 CET 2019


Commit: aac875421ff76999b82c42853c8c435ac37fa128
Author: Charlie Jolly
Date:   Fri Mar 1 13:29:04 2019 +0000
Branches: greasepencil-object
https://developer.blender.org/rBaac875421ff76999b82c42853c8c435ac37fa128

GPencil: Fill changes

+ Replace Strokes with Adaptive
+ Remove dilate option, always on
+ UI changes

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

M	release/scripts/startup/bl_ui/properties_paint_common.py
M	release/scripts/startup/bl_ui/space_topbar.py
M	source/blender/editors/gpencil/drawgpencil.c
M	source/blender/editors/gpencil/gpencil_fill.c
M	source/blender/editors/gpencil/gpencil_intern.h
M	source/blender/makesdna/DNA_brush_types.h
M	source/blender/makesrna/intern/rna_brush.c

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

diff --git a/release/scripts/startup/bl_ui/properties_paint_common.py b/release/scripts/startup/bl_ui/properties_paint_common.py
index f2f4c1f37db..2f62b2e400e 100644
--- a/release/scripts/startup/bl_ui/properties_paint_common.py
+++ b/release/scripts/startup/bl_ui/properties_paint_common.py
@@ -419,7 +419,7 @@ def brush_basic_gpencil_paint_settings(layout, context, brush, *, compact=True):
         row = layout.row(align=True)
         row.prop(gp_settings, "fill_simplify_level", text="Simplify")
         row = layout.row(align=True)
-        row.prop(gp_settings, "fill_draw_mode", text="Mode")
+        row.prop(gp_settings, "fill_draw_mode", text="Boundary")
         row.prop(gp_settings, "show_fill_boundary", text="", icon='GRID')
     else:  # brush.gpencil_tool == 'DRAW':
         row = layout.row(align=True)
diff --git a/release/scripts/startup/bl_ui/space_topbar.py b/release/scripts/startup/bl_ui/space_topbar.py
index 693c7d19014..be599645ac7 100644
--- a/release/scripts/startup/bl_ui/space_topbar.py
+++ b/release/scripts/startup/bl_ui/space_topbar.py
@@ -1060,8 +1060,6 @@ class TOPBAR_PT_gpencil_fill(Panel):
         layout = self.layout
         # Fill
         row = layout.row(align=True)
-        row.prop(gp_settings, "fill_dilate", text="Dilate")
-        row = layout.row(align=True)
         row.prop(gp_settings, "fill_factor", text="Resolution")
         if gp_settings.fill_draw_mode != 'STROKE':
             row = layout.row(align=True)
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index e851dd1714e..3dd2d7d0680 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -724,7 +724,7 @@ static void gp_draw_stroke_3d(tGPDdraw *tgpw, short thickness, const float ink[4
 	immUniform1i("xraymode", GP_XRAY_3DSPACE);
 	immUniform1i("caps_start", (int)tgpw->gps->caps[0]);
 	immUniform1i("caps_end", (int)tgpw->gps->caps[1]);
-	immUniform1i("fill_stroke", (int)tgpw->is_adaptive_fill);
+	immUniform1i("fill_stroke", (int)tgpw->is_fill_stroke);
 
 	/* draw stroke curve */
 	GPU_line_width(max_ff(curpressure * thickness, 1.0f));
@@ -1029,7 +1029,7 @@ static void gp_draw_strokes(tGPDdraw *tgpw)
 		/* calculate thickness */
 		sthickness = gps->thickness + tgpw->lthick;
 
-		if (tgpw->is_adaptive_fill) {
+		if (tgpw->is_fill_stroke) {
 			sthickness = (short)max_ii(1, sthickness / 2);
 		}
 
@@ -1430,7 +1430,7 @@ static void gp_draw_data_layers(RegionView3D *rv3d,
 	tgpw.winx = winx;
 	tgpw.winy = winy;
 	tgpw.dflag = dflag;
-	tgpw.is_adaptive_fill = false;
+	tgpw.is_fill_stroke = false;
 
 	for (bGPDlayer *gpl = gpd->layers.first; gpl; gpl = gpl->next) {
 		/* calculate parent position */
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index b89f5b85bde..b69eb8e1e7c 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -134,8 +134,6 @@ typedef struct tGPDfill {
 	int fill_draw_mode;
 	/* scaling factor */
 	short fill_factor;
-	/* dilate */
-	bool fill_dilate;
 
 	/** number of elements currently in cache */
 	short sbuffer_size;
@@ -283,8 +281,8 @@ static void gp_draw_datablock(tGPDfill *tgpf, const float ink[4])
 			tgpw.t_gpf = gpf;
 
 			/* reduce thickness to avoid gaps */
-			tgpw.is_adaptive_fill = (tgpf->fill_draw_mode == GP_FILL_DMODE_ADAPTIVE) ? true : false ;
-			tgpw.lthick = tgpw.is_adaptive_fill ? gpl->line_change : gpl->line_change - 4;
+			tgpw.is_fill_stroke = (tgpf->fill_draw_mode == GP_FILL_DMODE_CONTROL) ? false : true ;
+			tgpw.lthick = gpl->line_change;
 			tgpw.opacity = 1.0;
 			copy_v4_v4(tgpw.tintcolor, ink);
 			tgpw.onion = true;
@@ -294,7 +292,6 @@ static void gp_draw_datablock(tGPDfill *tgpf, const float ink[4])
 
 			/* normal strokes */
 			if (((tgpf->fill_draw_mode == GP_FILL_DMODE_STROKE) ||
-				(tgpf->fill_draw_mode == GP_FILL_DMODE_ADAPTIVE) ||
 			    (tgpf->fill_draw_mode == GP_FILL_DMODE_BOTH)) &&
 				!textured_stroke)
 			{
@@ -303,7 +300,6 @@ static void gp_draw_datablock(tGPDfill *tgpf, const float ink[4])
 
 			/* 3D Lines with basic shapes and invisible lines */
 			if ((tgpf->fill_draw_mode == GP_FILL_DMODE_CONTROL) ||
-			    (tgpf->fill_draw_mode == GP_FILL_DMODE_ADAPTIVE) ||
 			    (tgpf->fill_draw_mode == GP_FILL_DMODE_BOTH) ||
 				textured_stroke)
 			{
@@ -826,9 +822,7 @@ static void gpencil_get_outline_points(tGPDfill *tgpf)
 	int imagesize = ibuf->x * ibuf->y;
 
 	/* dilate */
-	if (tgpf->fill_dilate) {
-		dilate(ibuf);
-	}
+	dilate(ibuf);
 
 	/* find the initial point to start outline analysis */
 	for (int idx = imagesize - 1; idx != 0; idx--) {
@@ -1220,7 +1214,6 @@ static tGPDfill *gp_session_init_fill(bContext *C, wmOperator *UNUSED(op))
 	tgpf->fill_threshold = brush->gpencil_settings->fill_threshold;
 	tgpf->fill_simplylvl = brush->gpencil_settings->fill_simplylvl;
 	tgpf->fill_draw_mode = brush->gpencil_settings->fill_draw_mode;
-	tgpf->fill_dilate = (bool)brush->gpencil_settings->fill_dilate;
 	tgpf->fill_factor = (short)max_ii(1, min_ii((int)brush->gpencil_settings->fill_factor,8));
 	
 	/* get color info */
diff --git a/source/blender/editors/gpencil/gpencil_intern.h b/source/blender/editors/gpencil/gpencil_intern.h
index 3ba61ab25e3..416f3093886 100644
--- a/source/blender/editors/gpencil/gpencil_intern.h
+++ b/source/blender/editors/gpencil/gpencil_intern.h
@@ -92,7 +92,7 @@ typedef struct tGPDdraw {
 	float tintcolor[4];                 /* tint color */
 	bool onion;                         /* onion flag */
 	bool custonion;                     /* use custom onion colors */
-	bool is_adaptive_fill;              /* use fill tool */
+	bool is_fill_stroke;              /* use fill tool */
 	float diff_mat[4][4];               /* matrix */
 } tGPDdraw;
 
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index 5a425370684..21d212eebae 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -85,9 +85,7 @@ typedef struct BrushGpencilSettings {
 	short fill_leak;
 	/** Fill zoom factor */
 	short fill_factor;
-	/** Fill dilate */
-	char fill_dilate;
-	char _pad_1[3];
+	char _pad_1[4];
 
 	/** Number of simplify steps. */
 	int fill_simplylvl;
@@ -161,7 +159,6 @@ typedef enum eGP_FillDrawModes {
 	GP_FILL_DMODE_BOTH = 0,
 	GP_FILL_DMODE_STROKE = 1,
 	GP_FILL_DMODE_CONTROL = 2,
-	GP_FILL_DMODE_ADAPTIVE = 3,
 } eGP_FillDrawModes;
 
 /* BrushGpencilSettings->gp_eraser_mode */
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index fb5ec7c7648..0806e00c154 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -129,7 +129,6 @@ static EnumPropertyItem rna_enum_gpencil_fill_draw_modes_items[] = {
 	{GP_FILL_DMODE_STROKE, "STROKE", 0, "Strokes", "Use visible strokes as fill boundary limits"},
 	{GP_FILL_DMODE_CONTROL, "CONTROL", 0, "Control", "Use internal control lines as fill boundary limits"},
 	{GP_FILL_DMODE_BOTH, "BOTH", 0, "Both", "Use visible strokes and control lines as fill boundary limits"},
-	{GP_FILL_DMODE_ADAPTIVE, "ADAPTIVE", 0, "Adaptive", "Use thin strokes and control lines as fill boundary limits"},
 	{0, NULL, 0, NULL, NULL}
 };
 
@@ -1152,13 +1151,6 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
 	RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
 	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
 
-	/* fill dilate */
-	prop = RNA_def_property(srna, "fill_dilate", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "fill_dilate", 0);
-	RNA_def_property_ui_text(prop, "Dilate", "Spread fill area");
-	RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0);
-	RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
 	/* fill factor size */
 	prop = RNA_def_property(srna, "fill_factor", PROP_INT, PROP_NONE);
 	RNA_def_property_int_sdna(prop, NULL, "fill_factor");



More information about the Bf-blender-cvs mailing list