[Bf-blender-cvs] [0a3e04b13bb] greasepencil-object: GPencil: Add new Simplify parameter for Brush
Antonio Vazquez
noreply at git.blender.org
Tue Aug 13 22:51:59 CEST 2019
Commit: 0a3e04b13bbc509568932f6e5557af3b349b95d0
Author: Antonio Vazquez
Date: Tue Aug 13 22:51:46 2019 +0200
Branches: greasepencil-object
https://developer.blender.org/rB0a3e04b13bbc509568932f6e5557af3b349b95d0
GPencil: Add new Simplify parameter for Brush
This option is to test new types of brushes.
===================================================================
M release/scripts/startup/bl_ui/space_view3d_toolbar.py
M source/blender/editors/gpencil/gpencil_paint.c
M source/blender/makesdna/DNA_brush_types.h
M source/blender/makesrna/intern/rna_brush.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 1378615b8a0..55a5c6d95b1 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1891,6 +1891,9 @@ class VIEW3D_PT_tools_grease_pencil_brush_settings(View3DPanel, Panel):
col.prop(gp_settings, "pen_subdivision_steps")
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 894fb6eced4..b386a1ca751 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1224,6 +1224,12 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
}
}
+ /* 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);
+ }
+
/* reproject to plane (only in 3d space) */
gp_reproject_toplane(p, gps);
/* change position relative to parent object */
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index 93ce3d9769b..4327c28ba69 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;
@@ -485,7 +486,7 @@ typedef enum eBrushUVSculptTool {
SCULPT_TOOL_THUMB, \
SCULPT_TOOL_LAYER, \
\
- /* These brushes could handle dynamic topology, \
+ /* These brushes could handle dynamic topology, \ \
* but user feedback indicates it's better not to */ \
SCULPT_TOOL_SMOOTH, \
SCULPT_TOOL_MASK) == 0)
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 713ddfa0067..ee439147956 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -1184,6 +1184,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_FACTOR);
+ 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");
More information about the Bf-blender-cvs
mailing list