[Bf-blender-cvs] [47ff54b0080] master: GPencil: Ensure previous brush is set when change mode

Antonio Vazquez noreply at git.blender.org
Thu Jun 25 17:13:39 CEST 2020


Commit: 47ff54b0080b5015244cd64a4f69f3baca2c5ab0
Author: Antonio Vazquez
Date:   Thu Jun 25 17:13:21 2020 +0200
Branches: master
https://developer.blender.org/rB47ff54b0080b5015244cd64a4f69f3baca2c5ab0

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.

===================================================================

M	source/blender/blenkernel/intern/brush.c

===================================================================

diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 0a991d3ef4a..417fd182e73 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -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)



More information about the Bf-blender-cvs mailing list