[Bf-blender-cvs] [a042d307455] greasepencil-object: Fix error of missing slots
Antonio Vazquez
noreply at git.blender.org
Fri Apr 27 09:07:48 CEST 2018
Commit: a042d307455d4ee54992193bebad0c159e96d8a6
Author: Antonio Vazquez
Date: Fri Apr 27 09:07:20 2018 +0200
Branches: greasepencil-object
https://developer.blender.org/rBa042d307455d4ee54992193bebad0c159e96d8a6
Fix error of missing slots
The problem was in the creation of material slot all the time. By default, the material is created when we have a slot already created.
===================================================================
M source/blender/blenkernel/intern/gpencil.c
===================================================================
diff --git a/source/blender/blenkernel/intern/gpencil.c b/source/blender/blenkernel/intern/gpencil.c
index 8c20bba8e5f..8d95618f9ed 100644
--- a/source/blender/blenkernel/intern/gpencil.c
+++ b/source/blender/blenkernel/intern/gpencil.c
@@ -1054,7 +1054,9 @@ Material *BKE_gpencil_color_ensure(Main *bmain, Object *ob)
mat = give_current_material(ob, ob->actcol);
if (mat == NULL) {
- BKE_object_material_slot_add(ob);
+ if (ob->totcol == 0) {
+ BKE_object_material_slot_add(ob);
+ }
mat = BKE_material_add_gpencil(bmain, DATA_("Material"));
assign_material(ob, mat, ob->totcol, BKE_MAT_ASSIGN_EXISTING);
}
More information about the Bf-blender-cvs
mailing list