Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2014-07-12 15:02:37 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-07-12 15:02:37 +0400
commit61e7968555b34607c1e7e98622eac93125bcfe6e (patch)
tree5f48cd7d878fc9df10976f27540df30b18d11255
parentae6f74e84165be13a0875549f020860a22516ece (diff)
Better fix for texture name lookup
-rw-r--r--source/blender/editors/sculpt_paint/paint_image_proj.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c
index 7442bce02fa..1f0b2c80fc4 100644
--- a/source/blender/editors/sculpt_paint/paint_image_proj.c
+++ b/source/blender/editors/sculpt_paint/paint_image_proj.c
@@ -4798,8 +4798,6 @@ void PAINT_OT_image_from_view(wmOperatorType *ot)
/* Add layer operator */
-#define TEXNAME_MAX 30
-
static EnumPropertyItem layer_type_items[] = {
{MAP_COL, "DIFFUSE_COLOR", 0, "Diffuse Color", ""},
{MAP_REF, "DIFFUSE_INTENSITY", 0, "Diffuse Intensity", ""},
@@ -4853,23 +4851,20 @@ bool proj_paint_add_slot(bContext *C, int type, Material *ma)
/* successful creation of mtex layer, now create set */
if (mtex) {
- char imagename[FILE_MAX];
- char name[TEXNAME_MAX];
Main *bmain = CTX_data_main(C);
Image *ima;
+ const char *name;
/* get the name of the texture layer type */
- for (i = 0; i < ARRAY_SIZE(layer_type_items); i++) {
- if (type == layer_type_items[i].value) {
- BLI_strncpy(name, layer_type_items[i].name, TEXNAME_MAX);
- break;
- }
- }
+ i = RNA_enum_from_value(layer_type_items, type);
+ BLI_assert(i != -1);
+ name = layer_type_items[i].name;
mtex->tex = add_texture(bmain, DATA_(name));
mtex->mapto = type;
if (mtex->tex) {
+ char imagename[FILE_MAX];
float color[4];
bool use_float = type == MAP_NORM;