From 07c96cc102a55217011e8b92429a82d195068d34 Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Mon, 25 Aug 2014 00:34:24 +0200 Subject: Fix nice trash read in new texture slot operator. --- source/blender/editors/sculpt_paint/paint_image_proj.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'source') diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index ba6b6cacd73..643e4aa37cd 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) { -- cgit v1.2.3