diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-03-05 20:48:09 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-03-05 20:50:44 +0300 |
commit | a7d292394ea2aa39980eda1f5e696b7fa9f70d47 (patch) | |
tree | c070e4be69ed671d078b25d108242be21322a70c /source | |
parent | 04b0a9f4b885e8e3b0b3207f3b3cda74b936df3e (diff) |
Fix T43898, correct all uv layers in bevel, not only the active one
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/bmesh/tools/bmesh_bevel.c | 31 |
1 files changed, 18 insertions, 13 deletions
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c index 74788d7068d..2ef93618e2a 100644 --- a/source/blender/bmesh/tools/bmesh_bevel.c +++ b/source/blender/bmesh/tools/bmesh_bevel.c @@ -525,23 +525,28 @@ static void bev_merge_uvs(BMesh *bm, BMVert *v) BMLoop *l; float uv[2]; int n; - int cd_loop_uv_offset = CustomData_get_offset(&bm->ldata, CD_MLOOPUV); + int num_of_uv_layers = CustomData_number_of_layers(&bm->ldata, CD_MLOOPUV); + int i; - if (cd_loop_uv_offset == -1) - return; + for (i = 0; i < num_of_uv_layers; i++) { + int cd_loop_uv_offset = CustomData_get_n_offset(&bm->ldata, CD_MLOOPUV, i); - n = 0; - zero_v2(uv); - BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) { - luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); - add_v2_v2(uv, luv->uv); - n++; - } - if (n > 1) { - mul_v2_fl(uv, 1.0f / (float)n); + if (cd_loop_uv_offset == -1) + return; + + n = 0; + zero_v2(uv); BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); - copy_v2_v2(luv->uv, uv); + add_v2_v2(uv, luv->uv); + n++; + } + if (n > 1) { + mul_v2_fl(uv, 1.0f / (float)n); + BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) { + luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); + copy_v2_v2(luv->uv, uv); + } } } } |