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>2019-04-26 18:18:35 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2019-04-26 18:21:10 +0300
commit8973d1e7697c8272ba15aa7ecb79f0de66930086 (patch)
treed4b944f4050b1ddcd4273c6355486587df79dda1 /source/blender/blenkernel/intern/DerivedMesh.c
parent8192bcd7c19d41a1706fd31466cdab17a167aaf3 (diff)
Fix T63660: Data Transfer of normals No Longer Working.
Logic about computing of poly normals in final stage of modifier stack evaluation was broken, giving also wrong loop normals.
Diffstat (limited to 'source/blender/blenkernel/intern/DerivedMesh.c')
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c
index e70fcfe75c1..566135592be 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.c
+++ b/source/blender/blenkernel/intern/DerivedMesh.c
@@ -1045,10 +1045,21 @@ static void mesh_calc_modifier_final_normals(const Mesh *mesh_input,
const bool do_poly_normals = ((dataMask->pmask & CD_MASK_NORMAL) != 0);
if (do_loop_normals) {
- /* In case we also need poly normals, add the layer here, then BKE_mesh_calc_normals_split() will fill it. */
+ /* In case we also need poly normals, add the layer and compute them here
+ * (BKE_mesh_calc_normals_split() assumes that if that data exists, it is always valid). */
if (do_poly_normals) {
if (!CustomData_has_layer(&mesh_final->pdata, CD_NORMAL)) {
- CustomData_add_layer(&mesh_final->pdata, CD_NORMAL, CD_CALLOC, NULL, mesh_final->totpoly);
+ float(*polynors)[3] = CustomData_add_layer(
+ &mesh_final->pdata, CD_NORMAL, CD_CALLOC, NULL, mesh_final->totpoly);
+ BKE_mesh_calc_normals_poly(mesh_final->mvert,
+ NULL,
+ mesh_final->totvert,
+ mesh_final->mloop,
+ mesh_final->mpoly,
+ mesh_final->totloop,
+ mesh_final->totpoly,
+ polynors,
+ false);
}
}
/* Compute loop normals (note: will compute poly and vert normals as well, if needed!) */