Fix T52649: missing custom (split) normals from FBX exporter.

Own mistake in recent rB25c5928b2b6 (this DOES NOT affect 2.79 release).
This commit is contained in:
Bastien Montagne 2017-09-04 21:02:46 +02:00
parent 4a744727be
commit 6859695055
Notes: blender-bot 2023-02-14 19:35:29 +01:00
Referenced by issue #52685, Flip names for bones its not working
Referenced by issue #52679, hole in bake normal
Referenced by issue #52680, Alpha difference Viewport/F12
Referenced by issue #52661, Cycles render darker and noisier
Referenced by issue #52663, SEGV when D.images.remove(D.images[0], do_unlink=True)
Referenced by issue blender/blender-addons#52649, Broken fbx exporter
1 changed files with 6 additions and 4 deletions

View File

@ -2072,6 +2072,11 @@ void BKE_mesh_calc_normals_split_ex(Mesh *mesh, MLoopNorSpaceArray *r_lnors_spac
short (*clnors)[2] = NULL;
bool free_polynors = false;
/* Note that we enforce computing clnors when the clnor space array is requested by caller here.
* However, we obviously only use the autosmooth angle threshold only in case autosmooth is enabled. */
const bool use_split_normals = (r_lnors_spacearr != NULL) || ((mesh->flag & ME_AUTOSMOOTH) != 0);
const float split_angle = (mesh->flag & ME_AUTOSMOOTH) != 0 ? mesh->smoothresh : (float)M_PI;
if (CustomData_has_layer(&mesh->ldata, CD_NORMAL)) {
r_loopnors = CustomData_get_layer(&mesh->ldata, CD_NORMAL);
memset(r_loopnors, 0, sizeof(float[3]) * mesh->totloop);
@ -2100,10 +2105,7 @@ void BKE_mesh_calc_normals_split_ex(Mesh *mesh, MLoopNorSpaceArray *r_lnors_spac
BKE_mesh_normals_loop_split(
mesh->mvert, mesh->totvert, mesh->medge, mesh->totedge,
mesh->mloop, r_loopnors, mesh->totloop, mesh->mpoly, (const float (*)[3])polynors, mesh->totpoly,
/* Note that we enforce computing clnors when the clnor space array is requested by caller here.
* However, we obviously only use the autosmooth angle threshold only in case autosmooth is enabled. */
r_lnors_spacearr != NULL, (mesh->flag & ME_AUTOSMOOTH) != 0 ? mesh->smoothresh : (float)M_PI,
r_lnors_spacearr, clnors, NULL);
use_split_normals, split_angle, r_lnors_spacearr, clnors, NULL);
if (free_polynors) {
MEM_freeN(polynors);