From cdfae957f2471a207d0118b8643272cfea49871b Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 3 Mar 2017 10:47:22 +0100 Subject: When creating texture/image in Texture Paint mode, both datablocks should get the same name The paint slot name was not the same as what is displayed on the texture properties panel. Instead, the slot type (e.g. "Diffuse Color") was used as the name. Patch by Suchaaver (@minifigmaster125) with minor changes from @mont29. Reviewers: mont29, sergey Maniphest Tasks: T50704 Differential Revision: https://developer.blender.org/D2523 --- source/blender/editors/sculpt_paint/paint_image_proj.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'source/blender') diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index f5d115442c6..d0f1cc99b8d 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -5711,21 +5711,16 @@ static bool proj_paint_add_slot(bContext *C, wmOperator *op) /* successful creation of mtex layer, now create set */ if (mtex) { int type = MAP_COL; - int type_id = 0; + char imagename_buff[MAX_ID_NAME - 2]; + const char *imagename = DATA_("Diffuse Color"); if (op) { - int i; type = RNA_enum_get(op->ptr, "type"); - - for (i = 0; i < ARRAY_SIZE(layer_type_items); i++) { - if (layer_type_items[i].value == type) { - type_id = i; - break; - } - } + RNA_string_get(op->ptr, "name", imagename_buff); + imagename = imagename_buff; } - mtex->tex = BKE_texture_add(bmain, DATA_(layer_type_items[type_id].name)); + mtex->tex = BKE_texture_add(bmain, imagename); mtex->mapto = type; if (mtex->tex) { -- cgit v1.2.3