[Bf-blender-cvs] [8102646a9fc] greasepencil-object: WIP: New smooth thickness parameter
Antonio Vazquez
noreply at git.blender.org
Thu Nov 23 18:23:36 CET 2017
Commit: 8102646a9fc1b65975945017684200749423222d
Author: Antonio Vazquez
Date: Thu Nov 23 18:23:13 2017 +0100
Branches: greasepencil-object
https://developer.blender.org/rB8102646a9fc1b65975945017684200749423222d
WIP: New smooth thickness parameter
These parameters are part of the smooth test and can be removed in the future.
===================================================================
M release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M source/blender/editors/gpencil/gpencil_paint.c
M source/blender/makesdna/DNA_gpencil_types.h
M source/blender/makesrna/intern/rna_scene.c
===================================================================
diff --git a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index 2e29c63419a..a9ba46d55c8 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -418,6 +418,11 @@ class GreasePencilBrushOptionsPanel:
col.prop(brush, "pen_smooth_factor")
col.prop(brush, "pen_smooth_steps")
+ row = layout.row(align=True)
+ col = row.column(align=True)
+ col.prop(brush, "pen_thick_smooth_factor")
+ col.prop(brush, "pen_thick_smooth_steps")
+
col.separator()
row = col.row(align=False)
row.prop(brush, "pen_subdivision_steps")
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index ee5661eade1..c8261ef1102 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -984,14 +984,18 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
for (i = 0; i < gps->totpoints; i++) {
BKE_gp_smooth_stroke(gps, i, brush->draw_smoothfac - reduce, false);
BKE_gp_smooth_stroke_strength(gps, i, brush->draw_smoothfac);
- /* thickness needs to repeat process several times */
- for (int r2 = 0; r2 < 10; ++r2) {
- BKE_gp_smooth_stroke_thickness(gps, i, brush->draw_smoothfac);
- }
}
reduce += 0.25f; // reduce the factor
}
}
+ /* smooth thickness */
+ if (brush->thick_smoothfac > 0.0f) {
+ for (int r = 0; r < brush->thick_smoothlvl * 2; ++r) {
+ for (i = 0; i < gps->totpoints; i++) {
+ BKE_gp_smooth_stroke_thickness(gps, i, brush->thick_smoothfac);
+ }
+ }
+ }
/* reproject to plane (only in 3d space) */
gp_reproject_toplane(p, gps);
diff --git a/source/blender/makesdna/DNA_gpencil_types.h b/source/blender/makesdna/DNA_gpencil_types.h
index 708de563521..109b352cfe6 100644
--- a/source/blender/makesdna/DNA_gpencil_types.h
+++ b/source/blender/makesdna/DNA_gpencil_types.h
@@ -120,7 +120,9 @@ typedef struct bGPDbrush {
struct CurveMapping *cur_jitter;
float curcolor[3];
- char pad[4];
+ float thick_smoothfac; /* amount of thickness smoothing to apply to newly created strokes */
+ short thick_smoothlvl; /* number of times to apply thickness smooth factor to new strokes */
+ char pad[6];
} bGPDbrush;
/* bGPDbrush->flag */
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index 53573b10d50..1e42592257f 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -2226,6 +2226,22 @@ static void rna_def_gpencil_brush(BlenderRNA *brna)
"Number of times to smooth newly created strokes");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+ /* Thickness smoothing factor for new strokes */
+ prop = RNA_def_property(srna, "pen_thick_smooth_factor", PROP_FLOAT, PROP_NONE);
+ RNA_def_property_float_sdna(prop, NULL, "thick_smoothfac");
+ RNA_def_property_range(prop, 0.0, 2.0f);
+ RNA_def_property_ui_text(prop, "Smooth Thickness",
+ "Amount of thickness smoothing to apply after finish newly created strokes, to reduce jitter/noise");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
+ /* Thickness iterations of the Smoothing factor */
+ prop = RNA_def_property(srna, "pen_thick_smooth_steps", PROP_INT, PROP_NONE);
+ RNA_def_property_int_sdna(prop, NULL, "thick_smoothlvl");
+ RNA_def_property_range(prop, 1, 3);
+ RNA_def_property_ui_text(prop, "Iterations Thickness",
+ "Number of times to smooth thickness for newly created strokes");
+ RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
+
/* Subdivision level for new strokes */
prop = RNA_def_property(srna, "pen_subdivision_steps", PROP_INT, PROP_NONE);
RNA_def_property_int_sdna(prop, NULL, "sublevel");
More information about the Bf-blender-cvs
mailing list