diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2013-11-11 00:32:27 +0400 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2013-11-11 00:32:27 +0400 |
commit | 647f425265b38055a922eb665662fcd468891407 (patch) | |
tree | 4a1e1aa16a9d11f2975fae1787d85703fa157567 /source/blender/blenkernel/intern/mesh.c | |
parent | d27f8103dd0d2fcc20974431fa063a2a87d780de (diff) |
Fix [#37394] UV Map cannot be renamed.
Own epic failure! CustomData_get_named_layer() returns a relative index, not an absolute one. :(
Diffstat (limited to 'source/blender/blenkernel/intern/mesh.c')
-rw-r--r-- | source/blender/blenkernel/intern/mesh.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/mesh.c b/source/blender/blenkernel/intern/mesh.c index a77f768835a..844252c583c 100644 --- a/source/blender/blenkernel/intern/mesh.c +++ b/source/blender/blenkernel/intern/mesh.c @@ -708,26 +708,32 @@ bool BKE_mesh_uv_cdlayer_rename(Mesh *me, const char *old_name, const char *new_ return false; } else { - lidx = lidx_start + (fidx - fidx_start); + lidx = fidx; } } - pidx = pidx_start + (lidx - lidx_start); + pidx = lidx; } else { if (lidx == -1) { - lidx = lidx_start + (pidx - pidx_start); + lidx = pidx; } if (fidx == -1 && do_tessface) { - fidx = fidx_start + (pidx - pidx_start); + fidx = pidx; } } #if 0 /* For now, we do not consider mismatch in indices (i.e. same name leading to (relative) different indices). */ - else if ((pidx - pidx_start) != (lidx - lidx_start)) { - lidx = lidx_start + (pidx - pidx_start); + else if (pidx != lidx) { + lidx = pidx; } #endif + /* Go back to absolute indices! */ + pidx += pidx_start; + lidx += lidx_start; + if (fidx != -1) + fidx += fidx_start; + return BKE_mesh_uv_cdlayer_rename_index(me, pidx, lidx, fidx, new_name, do_tessface); } } |