[Bf-blender-cvs] [18a8306a194] greasepencil-refactor: GPencil: Fix reset all brushes in other modes
Antonio Vazquez
noreply at git.blender.org
Sun Feb 2 22:51:44 CET 2020
Commit: 18a8306a194ceb66aaca4f34e795be20379dfc55
Author: Antonio Vazquez
Date: Sun Feb 2 22:50:04 2020 +0100
Branches: greasepencil-refactor
https://developer.blender.org/rB18a8306a194ceb66aaca4f34e795be20379dfc55
GPencil: Fix reset all brushes in other modes
The operator was working with Draw brushes, but not with Sculp/Weight or Vertex Paint.
===================================================================
M source/blender/editors/gpencil/gpencil_data.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_data.c b/source/blender/editors/gpencil/gpencil_data.c
index 156cd017531..e0da0c30790 100644
--- a/source/blender/editors/gpencil/gpencil_data.c
+++ b/source/blender/editors/gpencil/gpencil_data.c
@@ -1624,25 +1624,33 @@ static int gp_brush_reset_exec(bContext *C, wmOperator *UNUSED(op))
case CTX_MODE_PAINT_GPENCIL: {
Paint *paint = &ts->gp_paint->paint;
brush = paint->brush;
- BKE_gpencil_brush_preset_set(bmain, brush, brush->gpencil_settings->preset_type);
+ if (brush && brush->gpencil_settings) {
+ BKE_gpencil_brush_preset_set(bmain, brush, brush->gpencil_settings->preset_type);
+ }
break;
}
case CTX_MODE_SCULPT_GPENCIL: {
Paint *paint = &ts->gp_sculptpaint->paint;
brush = paint->brush;
- BKE_gpencil_brush_preset_set(bmain, brush, brush->gpencil_settings->preset_type);
+ if (brush && brush->gpencil_settings) {
+ BKE_gpencil_brush_preset_set(bmain, brush, brush->gpencil_settings->preset_type);
+ }
break;
}
case CTX_MODE_WEIGHT_GPENCIL: {
Paint *paint = &ts->gp_weightpaint->paint;
brush = paint->brush;
- BKE_gpencil_brush_preset_set(bmain, brush, brush->gpencil_settings->preset_type);
+ if (brush && brush->gpencil_settings) {
+ BKE_gpencil_brush_preset_set(bmain, brush, brush->gpencil_settings->preset_type);
+ }
break;
}
case CTX_MODE_VERTEX_GPENCIL: {
Paint *paint = &ts->gp_vertexpaint->paint;
brush = paint->brush;
- BKE_gpencil_brush_preset_set(bmain, brush, brush->gpencil_settings->preset_type);
+ if (brush && brush->gpencil_settings) {
+ BKE_gpencil_brush_preset_set(bmain, brush, brush->gpencil_settings->preset_type);
+ }
break;
}
default:
@@ -1824,7 +1832,29 @@ static int gp_brush_reset_all_exec(bContext *C, wmOperator *UNUSED(op))
}
gp_brush_delete_mode_brushes(bmain, paint, mode);
- BKE_brush_gpencil_paint_presets(bmain, ts);
+
+ switch (mode) {
+ case CTX_MODE_PAINT_GPENCIL: {
+ BKE_brush_gpencil_paint_presets(bmain, ts);
+ break;
+ }
+ case CTX_MODE_SCULPT_GPENCIL: {
+ BKE_brush_gpencil_sculpt_presets(bmain, ts);
+ break;
+ }
+ case CTX_MODE_WEIGHT_GPENCIL: {
+ BKE_brush_gpencil_weight_presets(bmain, ts);
+ break;
+ }
+ case CTX_MODE_VERTEX_GPENCIL: {
+ BKE_brush_gpencil_vertex_presets(bmain, ts);
+ break;
+ }
+ default: {
+ break;
+ }
+ }
+
BKE_paint_toolslots_brush_validate(bmain, paint);
/* Set Again the first brush of the mode. */
More information about the Bf-blender-cvs
mailing list