[Bf-blender-cvs] [534a713dbf2] greasepencil-object: WIP: Remove duplicate fields gp_lazy_radius and gp_lazy_factor
Antonio Vazquez
noreply at git.blender.org
Fri May 11 18:14:27 CEST 2018
Commit: 534a713dbf2929f6ad7021c11707cccd72fc78ec
Author: Antonio Vazquez
Date: Fri May 11 18:09:32 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB534a713dbf2929f6ad7021c11707cccd72fc78ec
WIP: Remove duplicate fields gp_lazy_radius and gp_lazy_factor
These fields have been moved to existing smooth_stroke_radius and smooth_stroke_factor.
===================================================================
M release/scripts/startup/bl_ui/space_view3d_toolbar.py
M source/blender/blenkernel/intern/brush.c
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 e039d11e9d2..9019a9a1a46 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1425,8 +1425,8 @@ class VIEW3D_PT_tools_grease_pencil_brush_option(Panel):
col.prop(brush, "use_stabilizer", text="Stabilizer")
if brush.use_stabilizer:
col.separator()
- col.prop(brush, "lazy_radius", text="Distance")
- col.prop(brush, "lazy_factor", slider=True)
+ col.prop(brush, "smooth_stroke_radius", text="Distance")
+ col.prop(brush, "smooth_stroke_factor", slider=True)
col.separator()
col.prop(brush, "enable_random", text="Random Settings")
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index ea1361b48c4..3cb6b989c13 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -257,8 +257,8 @@ static void brush_gpencil_curvemap_reset(CurveMap *cuma, int preset)
/* create a set of grease pencil presets */
void BKE_brush_gpencil_presets(bContext *C)
{
-#define LAZY_RADIUS 40
-#define LAZY_FACTOR 0.9f
+#define SMOOTH_STROKE_RADIUS 40
+#define SMOOTH_STROKE_FACTOR 0.9f
ToolSettings *ts = CTX_data_tool_settings(C);
Paint *paint = BKE_brush_get_gpencil_paint(ts);
@@ -294,8 +294,8 @@ void BKE_brush_gpencil_presets(bContext *C)
brush->gp_icon_id = GPBRUSH_PENCIL;
brush->gp_brush_type = GP_BRUSH_TYPE_DRAW;
- brush->gp_lazy_radius = LAZY_RADIUS;
- brush->gp_lazy_factor = LAZY_FACTOR;
+ brush->smooth_stroke_radius = SMOOTH_STROKE_RADIUS;
+ brush->smooth_stroke_factor = SMOOTH_STROKE_FACTOR;
/* Pen brush */
brush = BKE_brush_add_gpencil(bmain, ts, "Draw Pen");
@@ -326,8 +326,8 @@ void BKE_brush_gpencil_presets(bContext *C)
brush->gp_icon_id = GPBRUSH_PEN;
brush->gp_brush_type = GP_BRUSH_TYPE_DRAW;
- brush->gp_lazy_radius = LAZY_RADIUS;
- brush->gp_lazy_factor = LAZY_FACTOR;
+ brush->smooth_stroke_radius = SMOOTH_STROKE_RADIUS;
+ brush->smooth_stroke_factor = SMOOTH_STROKE_FACTOR;
/* Ink brush */
brush = BKE_brush_add_gpencil(bmain, ts, "Draw Ink");
@@ -355,8 +355,8 @@ void BKE_brush_gpencil_presets(bContext *C)
brush->gp_icon_id = GPBRUSH_INK;
brush->gp_brush_type = GP_BRUSH_TYPE_DRAW;
- brush->gp_lazy_radius = LAZY_RADIUS;
- brush->gp_lazy_factor = LAZY_FACTOR;
+ brush->smooth_stroke_radius = SMOOTH_STROKE_RADIUS;
+ brush->smooth_stroke_factor = SMOOTH_STROKE_FACTOR;
/* Curve */
custom_curve = brush->curve_sensitivity;
@@ -392,8 +392,8 @@ void BKE_brush_gpencil_presets(bContext *C)
brush->gp_icon_id = GPBRUSH_INKNOISE;
brush->gp_brush_type = GP_BRUSH_TYPE_DRAW;
- brush->gp_lazy_radius = LAZY_RADIUS;
- brush->gp_lazy_factor = LAZY_FACTOR;
+ brush->smooth_stroke_radius = SMOOTH_STROKE_RADIUS;
+ brush->smooth_stroke_factor = SMOOTH_STROKE_FACTOR;
/* Curve */
custom_curve = brush->curve_sensitivity;
@@ -428,8 +428,8 @@ void BKE_brush_gpencil_presets(bContext *C)
brush->gp_icon_id = GPBRUSH_BLOCK;
brush->gp_brush_type = GP_BRUSH_TYPE_DRAW;
- brush->gp_lazy_radius = LAZY_RADIUS;
- brush->gp_lazy_factor = LAZY_FACTOR;
+ brush->smooth_stroke_radius = SMOOTH_STROKE_RADIUS;
+ brush->smooth_stroke_factor = SMOOTH_STROKE_FACTOR;
/* Marker brush */
brush = BKE_brush_add_gpencil(bmain, ts, "Draw Marker");
@@ -459,8 +459,8 @@ void BKE_brush_gpencil_presets(bContext *C)
brush->gp_icon_id = GPBRUSH_MARKER;
brush->gp_brush_type = GP_BRUSH_TYPE_DRAW;
- brush->gp_lazy_radius = LAZY_RADIUS;
- brush->gp_lazy_factor = LAZY_FACTOR;
+ brush->smooth_stroke_radius = SMOOTH_STROKE_RADIUS;
+ brush->smooth_stroke_factor = SMOOTH_STROKE_FACTOR;
/* Fill brush */
brush = BKE_brush_add_gpencil(bmain, ts, "Fill Area");
@@ -479,8 +479,8 @@ void BKE_brush_gpencil_presets(bContext *C)
brush->gp_thick_smoothlvl = 3;
brush->draw_subdivide = 1;
- brush->gp_lazy_radius = LAZY_RADIUS;
- brush->gp_lazy_factor = LAZY_FACTOR;
+ brush->smooth_stroke_radius = SMOOTH_STROKE_RADIUS;
+ brush->smooth_stroke_factor = SMOOTH_STROKE_FACTOR;
brush->draw_strength = 1.0f;
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 1af6435195c..583c9626821 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -304,7 +304,7 @@ static bool gp_stroke_filtermval(tGPsdata *p, const int mval[2], int pmval[2])
/* if lazy mouse, check minimum distance */
else if (GPENCIL_LAZY_MODE(brush, p->shift)) {
brush->gp_flag |= GP_BRUSH_STABILIZE_MOUSE_TEMP;
- if ((dx * dx + dy * dy) > (brush->gp_lazy_radius * brush->gp_lazy_radius)) {
+ if ((dx * dx + dy * dy) > (brush->smooth_stroke_radius * brush->smooth_stroke_radius)) {
return true;
}
else {
@@ -2354,7 +2354,7 @@ static void gpencil_draw_apply(bContext *C, wmOperator *op, tGPsdata *p, Depsgra
float last_mouse[2];
copy_v2fl_v2i(now_mouse, p->mval);
copy_v2fl_v2i(last_mouse, p->mvalo);
- interp_v2_v2v2(now_mouse, now_mouse, last_mouse, p->brush->gp_lazy_factor);
+ interp_v2_v2v2(now_mouse, now_mouse, last_mouse, p->brush->smooth_stroke_factor);
round_v2i_v2fl(p->mval, now_mouse);
}
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index fa1634c0af4..0ba4060fb21 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -171,9 +171,6 @@ typedef struct Brush {
int gp_fill_draw_mode; /* type of control lines drawing mode */
int gp_icon_id; /* icon identifier */
- int gp_lazy_radius; /* distance to last point to create new point */
- float gp_lazy_factor; /* factor of smooth */
-
float gp_uv_random; /* random factor for UV rotation */
int gp_input_samples; /* maximum distance before generate new point for very fast mouse movements */
int gp_brush_type; /* type of brush (draw, fill, erase, etc..) */
diff --git a/source/blender/makesrna/intern/rna_brush.c b/source/blender/makesrna/intern/rna_brush.c
index 0b482f2b8c6..1cc71bc71ec 100644
--- a/source/blender/makesrna/intern/rna_brush.c
+++ b/source/blender/makesrna/intern/rna_brush.c
@@ -1704,18 +1704,6 @@ static void rna_def_brush(BlenderRNA *brna)
"Number of simplify steps (large values reduce fill accuracy)");
RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
- prop = RNA_def_property(srna, "lazy_radius", PROP_INT, PROP_NONE);
- RNA_def_property_int_sdna(prop, NULL, "gp_lazy_radius");
- RNA_def_property_range(prop, 1, 200);
- RNA_def_property_ui_text(prop, "Distance", "Minimum distance from last point before stroke continues");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
- prop = RNA_def_property(srna, "lazy_factor", PROP_FLOAT, PROP_FACTOR);
- RNA_def_property_float_sdna(prop, NULL, "gp_lazy_factor");
- RNA_def_property_range(prop, 0.5, 0.99);
- RNA_def_property_ui_text(prop, "Factor", "Higher values give a smoother stroke");
- RNA_def_property_update(prop, NC_GPENCIL | ND_DATA, NULL);
-
prop = RNA_def_property(srna, "uv_random", PROP_FLOAT, PROP_FACTOR);
RNA_def_property_float_sdna(prop, NULL, "gp_uv_random");
RNA_def_property_range(prop, 0.0, 1.0);
More information about the Bf-blender-cvs
mailing list