[Bf-blender-cvs] [2f29a459868] greasepencil-object: Resuse Brush size field instead to use separated thickness field
Antonio Vazquez
noreply at git.blender.org
Fri May 11 17:54:51 CEST 2018
Commit: 2f29a459868133840bd1771bba2075a5efbb44a7
Author: Antonio Vazquez
Date: Fri May 11 17:54:35 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rB2f29a459868133840bd1771bba2075a5efbb44a7
Resuse Brush size field instead to use separated thickness field
Pending to reorganize Brush struct to remove unused pad bytes.
===================================================================
M release/scripts/startup/bl_ui/properties_grease_pencil_common.py
M release/scripts/startup/bl_ui/space_view3d_toolbar.py
M source/blender/blenkernel/intern/brush.c
M source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
M source/blender/editors/gpencil/drawgpencil.c
M source/blender/editors/gpencil/gpencil_fill.c
M source/blender/editors/gpencil/gpencil_paint.c
M source/blender/editors/gpencil/gpencil_primitive.c
M source/blender/editors/gpencil/gpencil_utils.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/properties_grease_pencil_common.py b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
index ed18be29933..a5fe6e62079 100644
--- a/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
+++ b/release/scripts/startup/bl_ui/properties_grease_pencil_common.py
@@ -58,7 +58,7 @@ def gpencil_active_brush_settings_simple(context, layout):
row.operator_menu_enum("gpencil.brush_change", "brush", text="", icon='BRUSH_DATA')
row.prop(brush, "name", text="")
- col.prop(brush, "line_width", slider=True)
+ col.prop(brush, "size", slider=True)
row = col.row(align=True)
row.prop(brush, "use_random_pressure", text="", icon='RNDCURVE')
row.prop(brush, "pen_sensitivity_factor", slider=True)
diff --git a/release/scripts/startup/bl_ui/space_view3d_toolbar.py b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
index 9a27582ad9b..e039d11e9d2 100644
--- a/release/scripts/startup/bl_ui/space_view3d_toolbar.py
+++ b/release/scripts/startup/bl_ui/space_view3d_toolbar.py
@@ -1345,7 +1345,7 @@ class VIEW3D_PT_tools_grease_pencil_brush(Panel):
# Brush details
if brush.gpencil_brush_type == 'ERASE':
col = layout.column(align=True)
- col.prop(brush, "line_width", text="Radius")
+ col.prop(brush, "size", text="Radius")
col.separator()
row = col.row()
@@ -1353,7 +1353,7 @@ class VIEW3D_PT_tools_grease_pencil_brush(Panel):
elif brush.gpencil_brush_type == 'FILL':
col = layout.column(align=True)
col.prop(brush, "gpencil_fill_leak", text="Leak Size")
- col.prop(brush, "line_width", text="Thickness")
+ col.prop(brush, "size", text="Thickness")
col.prop(brush, "gpencil_fill_simplyfy_lvl", text="Simplify")
col = layout.row(align=True)
@@ -1373,7 +1373,7 @@ class VIEW3D_PT_tools_grease_pencil_brush(Panel):
sub.prop(brush, "gpencil_fill_threshold", text="Threshold")
else: # brush.gpencil_brush_type == 'DRAW':
row = layout.row(align=True)
- row.prop(brush, "line_width", text="Radius")
+ row.prop(brush, "size", text="Radius")
row.prop(brush, "use_pressure", text="", icon='STYLUS_PRESSURE')
row = layout.row(align=True)
row.prop(brush, "pen_strength", slider=True)
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 4d5fddde1a2..ea1361b48c4 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -133,7 +133,7 @@ static void brush_defaults(Brush *brush)
brush->stencil_dimension[1] = 256;
/* grease pencil basic settings */
- brush->thickness = 3;
+ brush->size = 3;
brush->draw_smoothlvl = 1;
brush->gp_flag = 0;
brush->gp_flag |= GP_BRUSH_USE_PRESSURE;
@@ -269,7 +269,7 @@ void BKE_brush_gpencil_presets(bContext *C)
/* Pencil brush */
brush = BKE_brush_add_gpencil(bmain, ts, "Draw Pencil");
- brush->thickness = 25.0f;
+ brush->size = 25.0f;
brush->gp_flag |= (GP_BRUSH_USE_PRESSURE | GP_BRUSH_ENABLE_CURSOR);
brush->draw_sensitivity = 1.0f;
@@ -300,7 +300,7 @@ void BKE_brush_gpencil_presets(bContext *C)
/* Pen brush */
brush = BKE_brush_add_gpencil(bmain, ts, "Draw Pen");
deft = brush; /* save default brush */
- brush->thickness = 30.0f;
+ brush->size = 30.0f;
brush->gp_flag |= (GP_BRUSH_USE_PRESSURE | GP_BRUSH_ENABLE_CURSOR);
brush->draw_sensitivity = 1.0f;
@@ -331,7 +331,7 @@ void BKE_brush_gpencil_presets(bContext *C)
/* Ink brush */
brush = BKE_brush_add_gpencil(bmain, ts, "Draw Ink");
- brush->thickness = 60.0f;
+ brush->size = 60.0f;
brush->gp_flag |= (GP_BRUSH_USE_PRESSURE | GP_BRUSH_ENABLE_CURSOR);
brush->draw_sensitivity = 1.6f;
@@ -366,7 +366,7 @@ void BKE_brush_gpencil_presets(bContext *C)
/* Ink Noise brush */
brush = BKE_brush_add_gpencil(bmain, ts, "Draw Noise");
- brush->thickness = 60.0f;
+ brush->size = 60.0f;
brush->gp_flag |= (GP_BRUSH_USE_PRESSURE | GP_BRUSH_ENABLE_CURSOR);
brush->draw_sensitivity = 1.0f;
@@ -403,7 +403,7 @@ void BKE_brush_gpencil_presets(bContext *C)
/* Block Basic brush */
brush = BKE_brush_add_gpencil(bmain, ts, "Draw Block");
- brush->thickness = 150.0f;
+ brush->size = 150.0f;
brush->gp_flag |= (GP_BRUSH_USE_PRESSURE | GP_BRUSH_ENABLE_CURSOR);
brush->draw_sensitivity = 1.0f;
@@ -433,7 +433,7 @@ void BKE_brush_gpencil_presets(bContext *C)
/* Marker brush */
brush = BKE_brush_add_gpencil(bmain, ts, "Draw Marker");
- brush->thickness = 80.0f;
+ brush->size = 80.0f;
brush->gp_flag |= (GP_BRUSH_USE_PRESSURE | GP_BRUSH_ENABLE_CURSOR);
brush->draw_sensitivity = 1.0f;
@@ -464,7 +464,7 @@ void BKE_brush_gpencil_presets(bContext *C)
/* Fill brush */
brush = BKE_brush_add_gpencil(bmain, ts, "Fill Area");
- brush->thickness = 1.0f;
+ brush->size = 1.0f;
brush->gp_flag |= GP_BRUSH_ENABLE_CURSOR;
brush->draw_sensitivity = 1.0f;
brush->gp_fill_leak = 3;
@@ -486,7 +486,7 @@ void BKE_brush_gpencil_presets(bContext *C)
/* Soft Eraser brush */
brush = BKE_brush_add_gpencil(bmain, ts, "Eraser Soft");
- brush->thickness = 30.0f;
+ brush->size = 30.0f;
brush->gp_flag |= (GP_BRUSH_ENABLE_CURSOR | GP_BRUSH_DEFAULT_ERASER);
brush->gp_icon_id = GPBRUSH_ERASE_SOFT;
brush->gp_brush_type = GP_BRUSH_TYPE_ERASE;
@@ -494,7 +494,7 @@ void BKE_brush_gpencil_presets(bContext *C)
/* Hard Eraser brush */
brush = BKE_brush_add_gpencil(bmain, ts, "Eraser Hard");
- brush->thickness = 30.0f;
+ brush->size = 30.0f;
brush->gp_flag |= GP_BRUSH_ENABLE_CURSOR;
brush->gp_icon_id = GPBRUSH_ERASE_HARD;
brush->gp_brush_type = GP_BRUSH_TYPE_ERASE;
@@ -502,7 +502,7 @@ void BKE_brush_gpencil_presets(bContext *C)
/* Stroke Eraser brush */
brush = BKE_brush_add_gpencil(bmain, ts, "Eraser Stroke");
- brush->thickness = 30.0f;
+ brush->size = 30.0f;
brush->gp_flag |= GP_BRUSH_ENABLE_CURSOR;
brush->gp_icon_id = GPBRUSH_ERASE_STROKE;
brush->gp_brush_type = GP_BRUSH_TYPE_ERASE;
diff --git a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
index ecf022356c1..cba1b5ea963 100644
--- a/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
+++ b/source/blender/draw/engines/gpencil/gpencil_draw_cache_impl.c
@@ -653,7 +653,7 @@ void DRW_gpencil_populate_buffer_strokes(GPENCIL_e_data *e_data, void *vedata, T
/* It should also be noted that sbuffer contains temporary point types
* i.e. tGPspoints NOT bGPDspoints
*/
- short lthick = brush->thickness * obscale;
+ short lthick = brush->size * obscale;
/* if only one point, don't need to draw buffer because the user has no time to see it */
if (gpd->sbuffer_size > 1) {
if ((gp_style) && (gp_style->mode == GP_STYLE_MODE_LINE)) {
diff --git a/source/blender/editors/gpencil/drawgpencil.c b/source/blender/editors/gpencil/drawgpencil.c
index 58dda4d3f16..bc9ba23ff6b 100644
--- a/source/blender/editors/gpencil/drawgpencil.c
+++ b/source/blender/editors/gpencil/drawgpencil.c
@@ -1586,7 +1586,7 @@ static void gp_draw_data_layers(RegionView3D *rv3d,
/* calculate parent position */
ED_gpencil_parent_location(ob, gpd, gpl, diff_mat);
- short lthick = brush->thickness + gpl->thickness;
+ short lthick = brush->size + gpl->thickness;
/* don't draw layer if hidden */
if (gpl->flag & GP_LAYER_HIDE)
diff --git a/source/blender/editors/gpencil/gpencil_fill.c b/source/blender/editors/gpencil/gpencil_fill.c
index 7c69cb32b11..e3ea11c073d 100644
--- a/source/blender/editors/gpencil/gpencil_fill.c
+++ b/source/blender/editors/gpencil/gpencil_fill.c
@@ -823,7 +823,7 @@ static void gpencil_stroke_from_buffer(tGPDfill *tgpf)
/* create new stroke */
bGPDstroke *gps = MEM_callocN(sizeof(bGPDstroke), "bGPDstroke");
- gps->thickness = brush->thickness;
+ gps->thickness = brush->size;
gps->inittime = 0.0f;
/* the polygon must be closed, so enabled cyclic */
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index eebcd02a780..1af6435195c 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -942,7 +942,7 @@ static void gp_stroke_newfrombuffer(tGPsdata *p)
/* copy appropriate settings for stroke */
gps->totpoints = totelem;
- gps->thickness = brush->thickness;
+ gps->thickness = brush->size;
gps->flag = gpd->sbuffer_sflag;
gps->inittime = p->inittime;
@@ -1505,7 +1505,7 @@ static Brush *gp_get_default_eraser(Main *bmain, ToolSettings *ts)
/* create a new soft eraser brush */
else {
brush_dft = BKE_brush_add_gpencil(bmain, ts, "Soft Eraser");
- brush_dft->thickness = 30.0f;
+ brush_dft->size = 30.0f;
brush_dft->gp_flag |= (GP_BRUSH_ENABLE_CURSOR | GP_BRUSH_DEFAULT_ERASER);
brush_dft->gp_icon_id = GPBRUSH_ERASE_SOFT;
brush_dft->gp_brush_type = GP_BRUSH_TYPE_ERASE;
@@ -1550,7 +1550,7 @@ static void gp_init_drawing_brush(bContext *C, tGPsdata *p)
p->eraser = brush;
}
/* use radius of eraser */
- p->radius = (short)p->eraser->thickness;
+ p->radius = (short)p->eraser->size;
}
@@ -2786,7 +2786,7 @@ static void gpencil_add_missing_events(bContext *C, wmOperator *op, const wmEven
RegionView3D *rv3d = p->ar->regiondata;
float defaultpixsize = rv3d->pixsize * 1000.0f;
int samples = (GP_MAX_INPUT_SAMPLES - brush->gp_input_samples + 1);
- float thickness = (float)brush->thickness;
+ float thickness = (float)brush->size;
float pt[2], a[2], b[2];
float vec[3];
diff --git a/source/blender/editors/gpencil/gpencil_primitive.c b/source/blender/editors/gpencil/gpencil_primitive.c
index 5c3819b8e99..b33d66c1b5f 100644
--- a/source/blender/editors/gpencil/gpencil_primitive.c
+++ b/source/blender/editors/gpencil/gpencil_primitive.c
@@ -523,7 +523,7 @@ static void gpencil_primitive_done(bContext *C, wmOperator *op, wmWindow *win, t
/* prepare stroke to get transfered */
gps = tgpi->gpf->strokes.first;
if (gps) {
- gps->thickness = tgpi-
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list