[Bf-blender-cvs] [e6d4465f7fb] greasepencil-object: Add default brush material to object materials
Antonio Vazquez
noreply at git.blender.org
Mon Apr 30 17:22:28 CEST 2018
Commit: e6d4465f7fb1e80106af3b3e190191fbf2adeb07
Author: Antonio Vazquez
Date: Mon Apr 30 17:22:21 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rBe6d4465f7fb1e80106af3b3e190191fbf2adeb07
Add default brush material to object materials
When draw using a brush that uses a default material, the material must be added to the object material slots if this material was not before.
===================================================================
M source/blender/editors/gpencil/gpencil_paint.c
===================================================================
diff --git a/source/blender/editors/gpencil/gpencil_paint.c b/source/blender/editors/gpencil/gpencil_paint.c
index f7941af26d3..071dc3961ec 100644
--- a/source/blender/editors/gpencil/gpencil_paint.c
+++ b/source/blender/editors/gpencil/gpencil_paint.c
@@ -1574,6 +1574,11 @@ static void gp_init_colors(tGPsdata *p)
}
else {
p->material = mat;
+ /* check if the material is already on object material slots and add it if missing */
+ if (BKE_object_material_slot_find_index(p->ob, p->material) == 0) {
+ BKE_object_material_slot_add(p->ob);
+ assign_material(p->ob, mat, p->ob->totcol, BKE_MAT_ASSIGN_EXISTING);
+ }
}
/* assign color information to temp tGPsdata */
gpcolor = p->material->gpcolor;
More information about the Bf-blender-cvs
mailing list