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:
authorBastien Montagne <montagne29@wanadoo.fr>2015-04-13 16:41:57 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2015-04-13 16:44:09 +0300
commit8ad37b0d224fcf3eb09dd2b7def8bdcc386af1a1 (patch)
treefb901c4950132384944acd0afc355334805a831e /source/blender/blenkernel/intern/mesh_evaluate.c
parent17a9b05b9d2ec986223159b7ec92cddd236690a5 (diff)
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!
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_evaluate.c')
-rw-r--r--source/blender/blenkernel/intern/mesh_evaluate.c8
1 files changed, 8 insertions, 0 deletions
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]);