[Bf-blender-cvs] [8973d1e7697] master: Fix T63660: Data Transfer of normals No Longer Working.
Bastien Montagne
noreply at git.blender.org
Fri Apr 26 17:21:27 CEST 2019
Commit: 8973d1e7697c8272ba15aa7ecb79f0de66930086
Author: Bastien Montagne
Date: Fri Apr 26 17:18:35 2019 +0200
Branches: master
https://developer.blender.org/rB8973d1e7697c8272ba15aa7ecb79f0de66930086
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.
===================================================================
M source/blender/blenkernel/intern/DerivedMesh.c
===================================================================
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!) */
More information about the Bf-blender-cvs
mailing list