Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntonio Vazquez <blendergit@gmail.com>2019-09-11 13:27:47 +0300
committerAntonio Vazquez <blendergit@gmail.com>2019-09-11 13:28:23 +0300
commitef18b672f5a57d86d264af0f875a37c6a9c6677a (patch)
treee003422dc7945783e6dde1d927c8ed05fd412d96
parent7e61e597253f3ca75f2fb86a57212ca750ffbbe8 (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.
-rw-r--r--release/scripts/startup/bl_ui/space_view3d_toolbar.py3
-rw-r--r--source/blender/editors/gpencil/gpencil_paint.c7
-rw-r--r--source/blender/makesdna/DNA_brush_types.h3
-rw-r--r--source/blender/makesrna/intern/rna_brush.c8
4 files changed, 20 insertions, 1 deletions
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index e6cbef16595..3ff7bd83b1f 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1948,6 +1948,9 @@ class VIEW3D_PT_tools_grease_pencil_brush_settings(View3DPanel, Panel):
col.prop(gp_settings, "random_subdiv", text="Randomness", slider=True)
col = layout.column(align=True)
+ col.prop(gp_settings, "simplify_factor")
+
+ col = layout.column(align=True)
col.prop(gp_settings, "trim")
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");