GPencil: Ensure previous brush is set when change mode

In some situations, the previous brush is not set. This usually happens with previous version files.

Related to T78155.
This commit is contained in:
2020-06-25 17:13:21 +02:00
parent 495b0eff9a
commit 47ff54b008

View File

@@ -1185,6 +1185,11 @@ void BKE_brush_gpencil_paint_presets(Main *bmain, ToolSettings *ts, const bool r
if (reset || brush_prev == NULL) {
BKE_paint_brush_set(paint, deft_draw);
}
else {
if (brush_prev != NULL) {
BKE_paint_brush_set(paint, brush_prev);
}
}
}
/* Create a set of grease pencil Vertex Paint presets. */
@@ -1227,6 +1232,11 @@ void BKE_brush_gpencil_vertex_presets(Main *bmain, ToolSettings *ts, const bool
if (reset || brush_prev == NULL) {
BKE_paint_brush_set(vertexpaint, deft_vertex);
}
else {
if (brush_prev != NULL) {
BKE_paint_brush_set(vertexpaint, brush_prev);
}
}
}
/* Create a set of grease pencil Sculpt Paint presets. */
@@ -1297,6 +1307,11 @@ void BKE_brush_gpencil_sculpt_presets(Main *bmain, ToolSettings *ts, const bool
if (reset || brush_prev == NULL) {
BKE_paint_brush_set(sculptpaint, deft_sculpt);
}
else {
if (brush_prev != NULL) {
BKE_paint_brush_set(sculptpaint, brush_prev);
}
}
}
/* Create a set of grease pencil Weight Paint presets. */
@@ -1318,6 +1333,11 @@ void BKE_brush_gpencil_weight_presets(Main *bmain, ToolSettings *ts, const bool
if (reset || brush_prev == NULL) {
BKE_paint_brush_set(weightpaint, deft_weight);
}
else {
if (brush_prev != NULL) {
BKE_paint_brush_set(weightpaint, brush_prev);
}
}
}
struct Brush *BKE_brush_first_search(struct Main *bmain, const eObjectMode ob_mode)