diff options
author | Antonio Vazquez <blendergit@gmail.com> | 2019-09-11 13:27:47 +0300 |
---|---|---|
committer | Antonio Vazquez <blendergit@gmail.com> | 2019-09-11 13:28:23 +0300 |
commit | ef18b672f5a57d86d264af0f875a37c6a9c6677a (patch) | |
tree | e003422dc7945783e6dde1d927c8ed05fd412d96 /source/blender | |
parent | 7e61e597253f3ca75f2fb86a57212ca750ffbbe8 (diff) |
GPencil: New Brush postprocesing Simplify
This option allows to apply a simplify when the stroke is completed. The simplify use the Adaptive option to keep the shape.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/gpencil/gpencil_paint.c | 7 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_brush_types.h | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_brush.c | 8 |
3 files changed, 17 insertions, 1 deletions
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c index d5c701488c9..0a4b068a926 100644 --- a/source/blender/editors/gpencil/gpencil_paint.c +++ b/source/blender/editors/gpencil/gpencil_paint.c @@ -1235,6 +1235,13 @@ static void gp_stroke_newfrombuffer(tGPsdata *p) reduce += 0.25f; /* reduce the factor */ } } + + /* Simplify adaptive */ + if ((brush->gpencil_settings->flag & GP_BRUSH_GROUP_SETTINGS) && + (brush->gpencil_settings->simplify_f > 0.0f)) { + BKE_gpencil_simplify_stroke(gps, brush->gpencil_settings->simplify_f); + } + /* smooth thickness */ if ((brush->gpencil_settings->flag & GP_BRUSH_GROUP_SETTINGS) && (brush->gpencil_settings->thick_smoothfac > 0.0f)) { diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h index 3aafe5a1ddb..450788dc81d 100644 --- a/source/blender/makesdna/DNA_brush_types.h +++ b/source/blender/makesdna/DNA_brush_types.h @@ -113,7 +113,8 @@ typedef struct BrushGpencilSettings { float gradient_f; /** factor xy of shape for dots gradients */ float gradient_s[2]; - char _pad_2[4]; + /** Simplify adaptive factor */ + float simplify_f; struct CurveMapping *curve_sensitivity; struct CurveMapping *curve_strength; diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c index c3bdbfdd893..d642bcd6203 100644 --- a/source/blender/makesrna/intern/rna_brush.c +++ b/source/blender/makesrna/intern/rna_brush.c @@ -1189,6 +1189,14 @@ static void rna_def_gpencil_options(BlenderRNA *brna) RNA_def_property_clear_flag(prop, PROP_ANIMATABLE); RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL); + /* Simplify factor */ + prop = RNA_def_property(srna, "simplify_factor", PROP_FLOAT, PROP_NONE); + RNA_def_property_float_sdna(prop, NULL, "simplify_f"); + RNA_def_property_range(prop, 0, 100.0); + RNA_def_property_ui_range(prop, 0, 100.0, 1.0f, 3); + RNA_def_property_ui_text(prop, "Simplify", "Factor of Simplify using adaptive algorithm"); + RNA_def_parameter_clear_flags(prop, PROP_ANIMATABLE, 0); + /* Curves for pressure */ prop = RNA_def_property(srna, "curve_sensitivity", PROP_POINTER, PROP_NONE); RNA_def_property_pointer_sdna(prop, NULL, "curve_sensitivity"); |