Commit: fdff9ce59eaff239e1654bf6a8ffd4dbe6637973
Author: Antonioya
Date: Mon Dec 10 16:54:49 2018 +0100
Branches: greasepencil-object
https://developer.blender.org/rBfdff9ce59eaff239e1654bf6a8ffd4dbe6637973
GP: Set Brush default material when add new GP Object
Before the brush color was not set equal to object active color.
===================================================================
M source/blender/editors/gpencil/gpencil_add_monkey.c
M source/blender/editors/gpencil/gpencil_add_stroke.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_add_monkey.c
b/source/blender/editors/gpencil/gpencil_add_monkey.c
index f2967190406..4bd4acfe830 100644
--- a/source/blender/editors/gpencil/gpencil_add_monkey.c
+++ b/source/blender/editors/gpencil/gpencil_add_monkey.c
@@ -35,6 +35,7 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "BKE_brush.h"
#include "BKE_context.h"
#include "BKE_gpencil.h"
#include "BKE_main.h"
@@ -1440,6 +1441,10 @@ void ED_gpencil_create_monkey(bContext *C, float
mat[4][4])
/* set first color as active */
ob->actcol = color_Black + 1;
+ Material *ma = give_current_material(ob, ob->actcol);
+ if (ma != NULL) {
+ BKE_brush_update_material(bmain, ma, NULL);
+ }
/* layers */
/* NOTE: For now, we just add new layers, to make it easier to separate
out old/new instances */
diff --git a/source/blender/editors/gpencil/gpencil_add_stroke.c
b/source/blender/editors/gpencil/gpencil_add_stroke.c
index ccab4e3336c..69bb66edf41 100644
--- a/source/blender/editors/gpencil/gpencil_add_stroke.c
+++ b/source/blender/editors/gpencil/gpencil_add_stroke.c
@@ -35,6 +35,7 @@
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
+#include "BKE_brush.h"
#include "BKE_context.h"
#include "BKE_gpencil.h"
#include "BKE_main.h"
@@ -229,8 +230,12 @@ void ED_gpencil_create_stroke(bContext *C, float mat[4][4])
gp_stroke_material(bmain, ob, &gp_stroke_material_blue);
gp_stroke_material(bmain, ob, &gp_stroke_material_grey);
- /* set first color as active */
+ /* set first color as active and in brushes */
ob->actcol = color_black + 1;
+ Material *ma = give_current_material(ob, ob->actcol);
+ if (ma != NULL) {
+ BKE_brush_update_material(bmain, ma, NULL);
+ }
/* layers */
bGPDlayer *colors = BKE_gpencil_layer_addnew(gpd, "Colors", false);
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs