diff options
author | Alexander Romanov <a.romanov@blend4web.com> | 2017-07-04 16:03:04 +0300 |
---|---|---|
committer | Alexander Romanov <a.romanov@blend4web.com> | 2017-07-04 16:25:49 +0300 |
commit | 0ef48ad504350b934af42ddf47f73c9e096ce846 (patch) | |
tree | 640ac747907c1e9117938f2c39799ae66174ddc0 /source/blender/blenkernel/intern | |
parent | f23ed929ee021e11e8d47973d25f9039e9f91c17 (diff) |
One more fix for merged 'normal map tangents not working correctly when there are no UV maps.'
Diffstat (limited to 'source/blender/blenkernel/intern')
-rw-r--r-- | source/blender/blenkernel/intern/editmesh_tangent.c | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/mesh_tangent.c | 6 |
2 files changed, 5 insertions, 7 deletions
diff --git a/source/blender/blenkernel/intern/editmesh_tangent.c b/source/blender/blenkernel/intern/editmesh_tangent.c index 314c50d42c6..589c346b248 100644 --- a/source/blender/blenkernel/intern/editmesh_tangent.c +++ b/source/blender/blenkernel/intern/editmesh_tangent.c @@ -287,8 +287,6 @@ void BKE_editmesh_loop_tangent_calc( { BMesh *bm = em->bm; - BLI_assert(CustomData_number_of_layers(&bm->ldata, CD_MLOOPUV) != 0); - int act_uv_n = -1; int ren_uv_n = -1; bool calc_act = false; @@ -374,7 +372,7 @@ void BKE_editmesh_loop_tangent_calc( continue; /* needed for orco lookups */ htype_index |= BM_VERT; - *tangent_mask_curr_p |= DM_TANGENT_MASK_ORCO; + tangent_mask_curr |= DM_TANGENT_MASK_ORCO; } else { /* Fill the resulting tangent_mask */ @@ -382,7 +380,7 @@ void BKE_editmesh_loop_tangent_calc( int uv_start = CustomData_get_layer_index(&bm->ldata, CD_MLOOPUV); BLI_assert(uv_ind != -1 && uv_start != -1); BLI_assert(uv_ind - uv_start < MAX_MTFACE); - *tangent_mask_curr_p |= 1 << (uv_ind - uv_start); + tangent_mask_curr |= 1 << (uv_ind - uv_start); } if (mesh2tangent->precomputedFaceNormals) { /* needed for face normal lookups */ diff --git a/source/blender/blenkernel/intern/mesh_tangent.c b/source/blender/blenkernel/intern/mesh_tangent.c index 294ed604885..d370e202134 100644 --- a/source/blender/blenkernel/intern/mesh_tangent.c +++ b/source/blender/blenkernel/intern/mesh_tangent.c @@ -573,7 +573,7 @@ void BKE_mesh_calc_loop_tangent_ex( if (tangent_names[i][0]) BKE_mesh_add_loop_tangent_named_layer_for_uv(loopdata, loopdata_out, (int)loopdata_out_len, tangent_names[i]); if ((tangent_mask & DM_TANGENT_MASK_ORCO) && CustomData_get_named_layer_index(loopdata, CD_TANGENT, "") == -1) - CustomData_add_layer_named(loopdata, CD_TANGENT, CD_CALLOC, NULL, (int)loopdata_out_len, ""); + CustomData_add_layer_named(loopdata_out, CD_TANGENT, CD_CALLOC, NULL, (int)loopdata_out_len, ""); if (calc_act && act_uv_name[0]) BKE_mesh_add_loop_tangent_named_layer_for_uv(loopdata, loopdata_out, (int)loopdata_out_len, act_uv_name); if (calc_ren && ren_uv_name[0]) @@ -642,14 +642,14 @@ void BKE_mesh_calc_loop_tangent_ex( if (!mesh2tangent->orco) continue; - *tangent_mask_curr_p |= DM_TANGENT_MASK_ORCO; + tangent_mask_curr |= DM_TANGENT_MASK_ORCO; } else { int uv_ind = CustomData_get_named_layer_index(loopdata, CD_MLOOPUV, loopdata->layers[index].name); int uv_start = CustomData_get_layer_index(loopdata, CD_MLOOPUV); BLI_assert(uv_ind != -1 && uv_start != -1); BLI_assert(uv_ind - uv_start < MAX_MTFACE); - *tangent_mask_curr_p |= (short)(1 << (uv_ind - uv_start)); + tangent_mask_curr |= (short)(1 << (uv_ind - uv_start)); } mesh2tangent->tangent = loopdata_out->layers[index].data; |