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!
This commit is contained in:
Bastien Montagne 2015-04-13 15:41:57 +02:00
parent 17a9b05b9d
commit 8ad37b0d22
Notes: blender-bot 2023-02-14 09:15:30 +01:00
Referenced by issue #44359, normals_split_custom_set() does not behave as documented
1 changed files with 8 additions and 0 deletions

View File

@ -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]);