[Bf-blender-cvs] [07c96cc] master: Fix nice trash read in new texture slot operator.

Antony Riakiotakis noreply at git.blender.org
Mon Aug 25 00:34:43 CEST 2014


Commit: 07c96cc102a55217011e8b92429a82d195068d34
Author: Antony Riakiotakis
Date:   Mon Aug 25 00:34:24 2014 +0200
Branches: master
https://developer.blender.org/rB07c96cc102a55217011e8b92429a82d195068d34

Fix nice trash read in new texture slot operator.

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

M	source/blender/editors/sculpt_paint/paint_image_proj.c

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

diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index ba6b6ca..643e4aa 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -4849,11 +4849,21 @@ bool proj_paint_add_slot(bContext *C, Material *ma, wmOperator *op)
 				Main *bmain = CTX_data_main(C);
 				Image *ima;
 				int type = MAP_COL;
+				int type_id = 0;
 
-				if (op)
+				if (op) {
+					int i;
 					type = RNA_enum_get(op->ptr, "type");
 
-				mtex->tex = add_texture(bmain, DATA_(layer_type_items[type].name));
+					for (i = 0; i < ARRAY_SIZE(layer_type_items); i++) {
+						if (layer_type_items[i].value == type) {
+							type_id = i;
+							break;
+						}
+					}
+				}
+
+				mtex->tex = add_texture(bmain, DATA_(layer_type_items[type_id].name));
 				mtex->mapto = type;
 
 				if (mtex->tex) {




More information about the Bf-blender-cvs mailing list