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) {

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to