[Bf-blender-cvs] [adebd9813b8] greasepencil-object: GPencil: Limit internally Smart Smooth to range 0 to 0.5

Antonio Vazquez noreply at git.blender.org
Thu Oct 3 12:54:57 CEST 2019


Commit: adebd9813b87133c9a72c6e77fd3b28db2ab8f4b
Author: Antonio Vazquez
Date:   Thu Oct 3 12:54:46 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rBadebd9813b87133c9a72c6e77fd3b28db2ab8f4b

GPencil: Limit internally Smart Smooth to range 0 to 0.5

In the UI we keep a range between 0.0 to 1.0 for usability reasons, but internally, the value is divided by 2 to limit the real between 0.0 and to 0.5 and also makes it less sensible.

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

M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/makesrna/intern/rna_brush.c

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

diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index f2a96fd11da..d1f17f0c702 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -726,7 +726,9 @@ static void gp_smooth_fake_segments(tGPsdata *p)
         to_idx = i + (i - from_idx);
         /* Smooth this segments (need loop to get cumulative smooth). */
         for (int r = 0; r < 5; r++) {
-          gp_smooth_segment(gpd, brush->gpencil_settings->smart_smooth, from_idx, to_idx);
+          /* The factor is divided because a value > 0.5f is too aggressive, but in the UI is
+           * better to keep the range from 0.0f to 1.0f for usability reasons. */
+          gp_smooth_segment(gpd, brush->gpencil_settings->smart_smooth * 0.5f, from_idx, to_idx);
         }
       }
       else {
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index f99e88344bf..ae890d50992 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -1069,6 +1069,7 @@ static void rna_def_gpencil_options(BlenderRNA *brna)
   prop = RNA_def_property(srna, "pen_smart_smooth_factor", PROP_FLOAT, PROP_NONE);
   RNA_def_property_float_sdna(prop, NULL, "smart_smooth");
   RNA_def_property_range(prop, 0.0f, 1.0f);
+  RNA_def_property_float_default(prop, 0.2f);
   RNA_def_property_ui_text(prop, "Smart Smooth", "Factor of smoothing for fast movements");
   RNA_def_property_clear_flag(prop, PROP_ANIMATABLE);
   RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);



More information about the Bf-blender-cvs mailing list