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
This commit is contained in:
Bastien Montagne 2017-03-03 10:47:22 +01:00
parent 810d7d4694
commit cdfae957f2
1 changed files with 5 additions and 10 deletions

View File

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