From 8ad37b0d224fcf3eb09dd2b7def8bdcc386af1a1 Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Mon, 13 Apr 2015 15:41:57 +0200 Subject: Fix T44359: `mesh_normals_loop_custom_set()` would not behave correctly with zero-normals. Zero-normals here are used as a shortcut to say 'use auto-computed values'. So we have to do so in pre-process steps! --- source/blender/blenkernel/intern/mesh_evaluate.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c index ceb9b016ff2..bbc175fefcd 100644 --- a/source/blender/blenkernel/intern/mesh_evaluate.c +++ b/source/blender/blenkernel/intern/mesh_evaluate.c @@ -1349,6 +1349,10 @@ static void mesh_normals_loop_custom_set( const int nidx = lidx; float *nor = custom_loopnors[nidx]; + if (is_zero_v3(nor)) { + nor = lnors[nidx]; + } + if (!org_nor) { org_nor = nor; } @@ -1408,6 +1412,10 @@ static void mesh_normals_loop_custom_set( const int nidx = use_vertices ? (int)mloops[lidx].v : lidx; float *nor = custom_loopnors[nidx]; + if (is_zero_v3(nor)) { + nor = lnors[nidx]; + } + nbr_nors++; add_v3_v3(avg_nor, nor); BLI_SMALLSTACK_PUSH(clnors_data, (short *)r_clnors_data[lidx]); -- cgit v1.2.3