[Bf-blender-cvs] [2df4db3ac6a] greasepencil-object: GPencil: Fix brush icons
Antonio Vazquez
noreply at git.blender.org
Thu Nov 7 18:07:29 CET 2019
Commit: 2df4db3ac6a97c8d415cf96e2d42d653d440c343
Author: Antonio Vazquez
Date: Thu Nov 7 16:01:01 2019 +0100
Branches: greasepencil-object
https://developer.blender.org/rB2df4db3ac6a97c8d415cf96e2d42d653d440c343
GPencil: Fix brush icons
===================================================================
M source/blender/blenkernel/intern/brush.c
M source/blender/editors/interface/interface_icons.c
M source/blender/makesdna/DNA_brush_types.h
===================================================================
diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 6d79700ff89..3e11fcc74b8 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -282,7 +282,7 @@ void BKE_brush_gpencil_presets(Main *bmain, ToolSettings *ts)
Paint *paint = &ts->gp_paint->paint;
Paint *vertexpaint = &ts->gp_vertexpaint->paint;
- Brush *brush, *deft;
+ Brush *brush, *deft_draw, *deft_vertex;
CurveMapping *custom_curve;
/* Airbrush brush. */
@@ -540,7 +540,7 @@ void BKE_brush_gpencil_presets(Main *bmain, ToolSettings *ts)
/* Pencil brush. */
brush = gpencil_brush_ensure(bmain, ts, "Pencil", OB_MODE_PAINT_GPENCIL);
- deft = brush; /* save default brush. */
+ deft_draw = brush; /* save default brush. */
brush->size = 25.0f;
brush->gpencil_settings->flag |= (GP_BRUSH_USE_PRESSURE | GP_BRUSH_ENABLE_CURSOR);
@@ -661,13 +661,10 @@ void BKE_brush_gpencil_presets(Main *bmain, ToolSettings *ts)
brush->gpencil_settings->icon_id = GP_BRUSH_ICON_TINT;
brush->gpencil_tool = GPAINT_TOOL_TINT;
- /* Set default Draw brush. */
- BKE_paint_brush_set(paint, deft);
-
/* Vertex Paint Brushes. */
/* Vertex Draw brush. */
brush = gpencil_brush_ensure(bmain, ts, "Vertex Draw", OB_MODE_VERTEX_GPENCIL);
- deft = brush; /* save default brush. */
+ deft_vertex = brush; /* save default brush. */
brush->size = 25.0f;
brush->gpencil_settings->flag |= (GP_BRUSH_USE_PRESSURE | GP_BRUSH_ENABLE_CURSOR);
@@ -680,7 +677,7 @@ void BKE_brush_gpencil_presets(Main *bmain, ToolSettings *ts)
zero_v3(brush->secondary_rgb);
- // brush->gpencil_settings->icon_id = ICON_BRUSH_MIX;
+ brush->gpencil_settings->icon_id = GP_BRUSH_ICON_VERTEX_DRAW;
brush->gpencil_vertex_tool = GPVERTEX_TOOL_DRAW;
/* Vertex Blur brush. */
@@ -697,7 +694,7 @@ void BKE_brush_gpencil_presets(Main *bmain, ToolSettings *ts)
zero_v3(brush->secondary_rgb);
- // brush->gpencil_settings->icon_id = ICON_BRUSH_MIX;
+ brush->gpencil_settings->icon_id = GP_BRUSH_ICON_VERTEX_BLUR;
brush->gpencil_vertex_tool = GPVERTEX_TOOL_BLUR;
/* Vertex Average brush. */
@@ -714,7 +711,7 @@ void BKE_brush_gpencil_presets(Main *bmain, ToolSettings *ts)
zero_v3(brush->secondary_rgb);
- // brush->gpencil_settings->icon_id = ICON_BRUSH_MIX;
+ brush->gpencil_settings->icon_id = GP_BRUSH_ICON_VERTEX_AVERAGE;
brush->gpencil_vertex_tool = GPVERTEX_TOOL_AVERAGE;
/* Vertex Smear brush. */
@@ -731,11 +728,14 @@ void BKE_brush_gpencil_presets(Main *bmain, ToolSettings *ts)
zero_v3(brush->secondary_rgb);
- // brush->gpencil_settings->icon_id = ICON_BRUSH_MIX;
+ brush->gpencil_settings->icon_id = GP_BRUSH_ICON_VERTEX_SMEAR;
brush->gpencil_vertex_tool = GPVERTEX_TOOL_SMEAR;
/* Set default Vertex brush. */
- BKE_paint_brush_set(vertexpaint, deft);
+ BKE_paint_brush_set(vertexpaint, deft_vertex);
+
+ /* Set default Draw brush. */
+ BKE_paint_brush_set(paint, deft_draw);
}
struct Brush *BKE_brush_first_search(struct Main *bmain, const eObjectMode ob_mode)
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c
index ba7928f2fdb..d75c0ad5115 100644
--- a/source/blender/editors/interface/interface_icons.c
+++ b/source/blender/editors/interface/interface_icons.c
@@ -2038,7 +2038,8 @@ static int ui_id_brush_get_icon(const bContext *C, ID *id)
}
/* reset the icon */
- if ((ob != NULL) && (ob->mode & OB_MODE_PAINT_GPENCIL) && (br->gpencil_settings != NULL)) {
+ if ((ob != NULL) && (ob->mode & (OB_MODE_PAINT_GPENCIL | OB_MODE_VERTEX_GPENCIL)) &&
+ (br->gpencil_settings != NULL)) {
switch (br->gpencil_settings->icon_id) {
case GP_BRUSH_ICON_PENCIL:
br->id.icon_id = ICON_GPBRUSH_PENCIL;
@@ -2079,6 +2080,18 @@ static int ui_id_brush_get_icon(const bContext *C, ID *id)
case GP_BRUSH_ICON_TINT:
br->id.icon_id = ICON_BRUSH_TEXDRAW;
break;
+ case GP_BRUSH_ICON_VERTEX_DRAW:
+ br->id.icon_id = ICON_BRUSH_MIX;
+ break;
+ case GP_BRUSH_ICON_VERTEX_BLUR:
+ br->id.icon_id = ICON_BRUSH_BLUR;
+ break;
+ case GP_BRUSH_ICON_VERTEX_AVERAGE:
+ br->id.icon_id = ICON_BRUSH_BLUR;
+ break;
+ case GP_BRUSH_ICON_VERTEX_SMEAR:
+ br->id.icon_id = ICON_BRUSH_BLUR;
+ break;
default:
br->id.icon_id = ICON_GPBRUSH_PEN;
break;
diff --git a/source/blender/makesdna/DNA_brush_types.h b/source/blender/makesdna/DNA_brush_types.h
index 30ba961668e..ede5b1e3a48 100644
--- a/source/blender/makesdna/DNA_brush_types.h
+++ b/source/blender/makesdna/DNA_brush_types.h
@@ -184,6 +184,10 @@ typedef enum eGP_BrushIcons {
GP_BRUSH_ICON_AIRBRUSH = 11,
GP_BRUSH_ICON_CHISEL = 12,
GP_BRUSH_ICON_TINT = 13,
+ GP_BRUSH_ICON_VERTEX_DRAW = 14,
+ GP_BRUSH_ICON_VERTEX_BLUR = 15,
+ GP_BRUSH_ICON_VERTEX_AVERAGE = 16,
+ GP_BRUSH_ICON_VERTEX_SMEAR = 17,
} eGP_BrushIcons;
typedef enum eBrushCurvePreset {
@@ -521,7 +525,7 @@ typedef enum eBrushUVSculptTool {
SCULPT_TOOL_ELASTIC_DEFORM, \
SCULPT_TOOL_POSE, \
\
- /* 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)
More information about the Bf-blender-cvs
mailing list