diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2014-08-25 02:34:24 +0400 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2014-08-25 02:34:24 +0400 |
commit | 07c96cc102a55217011e8b92429a82d195068d34 (patch) | |
tree | c794aedd09229a7fa9bb2a2b1b5d2c5e2f114e77 /source | |
parent | 20700ca43e630d21f09c99ca8a888b45f0014dfc (diff) |
Fix nice trash read in new texture slot operator.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_image_proj.c | 14 |
1 files changed, 12 insertions, 2 deletions
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) { |