[Bf-blender-cvs] [c061daac12c] greasepencil-object: Use as Brush Material default slot 1

Antonio Vazquez noreply at git.blender.org
Sat May 5 17:17:40 CEST 2018


Commit: c061daac12c6a772a39dd085aa59dccdc126822c
Author: Antonio Vazquez
Date:   Sat May 5 17:17:32 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rBc061daac12c6a772a39dd085aa59dccdc126822c

Use as Brush Material default slot 1

Use always the first material as default if the brush hasn't assigned a material.

Before, the current slot was used as default, but this could create a misunderstanding and make the artist believe he could select the color in properties.

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

M	source/blender/editors/gpencil/gpencil_paint.c
M	source/blender/editors/gpencil/gpencil_utils.c

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

diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index 3cb2714ff28..9eba2a98e35 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1570,8 +1570,10 @@ static void gp_init_colors(tGPsdata *p)
 	 * NOTE: Ensures that everything we need will exist...
 	 */
 	if ((ma == NULL) || (ma->gpcolor == NULL)) {
-		p->material = BKE_gpencil_color_ensure(p->bmain, p->ob);
-		/* assign the material to the brush */
+		BKE_gpencil_color_ensure(p->bmain, p->ob);
+
+		/* assign always the first material to the brush */
+		p->material = give_current_material(p->ob, 1);
 		brush->material = p->material;
 	}
 	else {
diff --git a/source/blender/editors/gpencil/gpencil_utils.c b/source/blender/editors/gpencil/gpencil_utils.c
index 66525f44c1d..e5909fb0584 100644
--- a/source/blender/editors/gpencil/gpencil_utils.c
+++ b/source/blender/editors/gpencil/gpencil_utils.c
@@ -1428,8 +1428,9 @@ static void gp_brush_drawcursor(bContext *C, int x, int y, void *customdata)
 			/* get current drawing color */
 			ma = BKE_gpencil_get_color_from_brush(paintbrush);
 			if (ma == NULL) {
-				ma = BKE_gpencil_color_ensure(bmain, ob);
-				/* assign the material to the brush */
+				BKE_gpencil_color_ensure(bmain, ob);
+				/* assign the first material to the brush */
+				ma = give_current_material(ob, 1);
 				paintbrush->material = ma;
 			}
 			gpcolor = ma->gpcolor;



More information about the Bf-blender-cvs mailing list