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:
authorHans Goudey <h.goudey@me.com>2022-02-21 19:40:59 +0300
committerHans Goudey <h.goudey@me.com>2022-02-21 19:40:59 +0300
commita81cc5cbcb6c9e9ef4bee610ac1d325d33884e98 (patch)
tree3c641452be81e8f2f1b97108fa08eb1381d3e2f1 /source/blender/render/intern/bake.c
parent869dd2e6998f7c89f9c18cb90aaa38ac0b9ac91f (diff)
Fix: Avoid potential use of dirty normals
Instead of accessing the `CD_NORMAL` layer directly, use the proper API for accessing mesh normals. Even if the layer exists, the values might be incorrect due to a deformation. Related to ef0e21f0ae71d, 969c4a45ce09100e, and T95839.
Diffstat (limited to 'source/blender/render/intern/bake.c')
-rw-r--r--source/blender/render/intern/bake.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/render/intern/bake.c b/source/blender/render/intern/bake.c
index 883e026472b..b11d9629e03 100644
--- a/source/blender/render/intern/bake.c
+++ b/source/blender/render/intern/bake.c
@@ -482,7 +482,9 @@ static TriTessFace *mesh_calc_tri_tessface(Mesh *me, bool tangent, Mesh *me_eval
looptri = MEM_mallocN(sizeof(*looptri) * tottri, __func__);
triangles = MEM_callocN(sizeof(TriTessFace) * tottri, __func__);
- const float(*precomputed_normals)[3] = CustomData_get_layer(&me->pdata, CD_NORMAL);
+ const float(*precomputed_normals)[3] = BKE_mesh_poly_normals_are_dirty(me) ?
+ NULL :
+ BKE_mesh_poly_normals_ensure(me);
const bool calculate_normal = precomputed_normals ? false : true;
if (precomputed_normals != NULL) {