[Bf-blender-cvs] [c65950d] master: GPencil: Remove the old UserPrefs-based On/Off Stroke Smoothing method

Joshua Leung noreply at git.blender.org
Sun Mar 27 16:39:39 CEST 2016


Commit: c65950dbb4d3ff728b012e5d9c91b6eb61fb95a6
Author: Joshua Leung
Date:   Mon Mar 28 03:39:26 2016 +1300
Branches: master
https://developer.blender.org/rBc65950dbb4d3ff728b012e5d9c91b6eb61fb95a6

GPencil: Remove the old UserPrefs-based On/Off Stroke Smoothing method

This never really worked that well, and often ended up being far too strong
to be of practical use. The new options do similar things, but with greater
control, so removing this old method now.

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

M	release/scripts/startup/bl_ui/space_userpref.py
M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/makesrna/intern/rna_userdef.c

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

diff --git a/release/scripts/startup/bl_ui/space_userpref.py b/release/scripts/startup/bl_ui/space_userpref.py
index 0100385..dc46aed 100644
--- a/release/scripts/startup/bl_ui/space_userpref.py
+++ b/release/scripts/startup/bl_ui/space_userpref.py
@@ -300,10 +300,10 @@ class USERPREF_PT_edit(Panel):
         col.prop(edit, "grease_pencil_manhattan_distance", text="Manhattan Distance")
         col.prop(edit, "grease_pencil_euclidean_distance", text="Euclidean Distance")
         col.separator()
-        col.prop(edit, "use_grease_pencil_smooth_stroke", text="Smooth Stroke")
+        col.prop(edit, "grease_pencil_default_color", text="Default Color")
+        col.separator()
         col.prop(edit, "use_grease_pencil_simplify_stroke", text="Simplify Stroke")
         col.separator()
-        col.prop(edit, "grease_pencil_default_color", text="Default Color")
         col.separator()
         col.separator()
         col.separator()
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index ea80e9a..040dfc4 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -449,45 +449,6 @@ static short gp_stroke_addpoint(tGPsdata *p, const int mval[2], float pressure,
 	return GP_STROKEADD_INVALID;
 }
 
-/* smooth a stroke (in buffer) before storing it */
-static void gp_stroke_smooth(tGPsdata *p)
-{
-	bGPdata *gpd = p->gpd;
-	tGPspoint *spt, tmp_spt[3];
-	int i = 0, cmx = gpd->sbuffer_size;
-	
-	/* only smooth if smoothing is enabled, and we're not doing a straight line */
-	if (!(U.gp_settings & GP_PAINT_DOSMOOTH) || ELEM(p->paintmode, GP_PAINTMODE_DRAW_STRAIGHT, GP_PAINTMODE_DRAW_POLY))
-		return;
-	
-	/* don't try if less than 2 points in buffer */
-	if ((cmx <= 2) || (gpd->sbuffer == NULL))
-		return;
-	
-	/* Calculate smoothing coordinates using weighted-averages
-	 * WARNING: we do NOT smooth first and last points (to avoid shrinkage)
-	 */
-	spt = (tGPspoint *)gpd->sbuffer;
-	
-	/* This (tmp_spt) small array stores the last two points' original coordinates,
-	 * as we don't want to use already averaged ones! It is used as a cyclic buffer...
-	 */
-	tmp_spt[0] = *spt;
-	for (i = 1, spt++; i < cmx - 1; i++, spt++) {
-		const tGPspoint *pc = spt;
-		const tGPspoint *pb = &tmp_spt[(i - 1) % 3];
-		const tGPspoint *pa = (i - 1 > 0) ? (&tmp_spt[(i - 2) % 3]) : (pb);
-		const tGPspoint *pd = pc + 1;
-		const tGPspoint *pe = (i + 2 < cmx) ? (pc + 2) : (pd);
-		
-		/* Store current point's original state for the two next points! */
-		tmp_spt[i % 3] = *spt;
-		
-		spt->x = (int)(0.1 * pa->x + 0.2 * pb->x + 0.4 * pc->x + 0.2 * pd->x + 0.1 * pe->x);
-		spt->y = (int)(0.1 * pa->y + 0.2 * pb->y + 0.4 * pc->y + 0.2 * pd->y + 0.1 * pe->y);
-	}
-}
-
 /* simplify a stroke (in buffer) before storing it
  *	- applies a reverse Chaikin filter
  *	- code adapted from etch-a-ton branch (editarmature_sketch.c)
@@ -1411,9 +1372,6 @@ static void gp_paint_strokeend(tGPsdata *p)
 	
 	/* check if doing eraser or not */
 	if ((p->gpd->sbuffer_sflag & GP_STROKE_ERASER) == 0) {
-		/* smooth stroke before transferring? */
-		gp_stroke_smooth(p);
-		
 		/* simplify stroke before transferring? */
 		gp_stroke_simplify(p);
 		
diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c
index 924bed3..efd302c 100644
--- a/source/blender/makesrna/intern/rna_userdef.c
+++ b/source/blender/makesrna/intern/rna_userdef.c
@@ -3790,10 +3790,6 @@ static void rna_def_userdef_edit(BlenderRNA *brna)
 	RNA_def_property_ui_text(prop, "Grease Pencil Euclidean Distance",
 	                         "Distance moved by mouse when drawing stroke to include");
 
-	prop = RNA_def_property(srna, "use_grease_pencil_smooth_stroke", PROP_BOOLEAN, PROP_NONE);
-	RNA_def_property_boolean_sdna(prop, NULL, "gp_settings", GP_PAINT_DOSMOOTH);
-	RNA_def_property_ui_text(prop, "Grease Pencil Smooth Stroke", "Smooth the final stroke");
-
 	prop = RNA_def_property(srna, "use_grease_pencil_simplify_stroke", PROP_BOOLEAN, PROP_NONE);
 	RNA_def_property_boolean_sdna(prop, NULL, "gp_settings", GP_PAINT_DOSIMPLIFY);
 	RNA_def_property_ui_text(prop, "Grease Pencil Simplify Stroke", "Simplify the final stroke");




More information about the Bf-blender-cvs mailing list