diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index 0309e7defbe..4a76abc0154 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -1070,6 +1070,19 @@ static void layerInterp_mvert_skin(void **sources, const float *weights, vs->flag &= ~MVERT_SKIN_ROOT; } +static void layerSwap_flnor(void *data, const int *corner_indices) +{ + short (*flnors)[4][3] = data; + short nors[4][3]; + int i = 4; + + while (i--) { + copy_v3_v3_short(nors[i], (*flnors)[corner_indices[i]]); + } + + memcpy(flnors, nors, sizeof(nors)); +} + static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = { /* 0: CD_MVERT */ {sizeof(MVert), "MVert", 1, NULL, NULL, NULL, NULL, NULL, NULL}, @@ -1182,7 +1195,7 @@ static const LayerTypeInfo LAYERTYPEINFO[CD_NUMTYPES] = { /* 39: CD_MLOOPTANGENT */ {sizeof(float[4]), "", 0, NULL, NULL, NULL, NULL, NULL, NULL}, /* 40: CD_TESSLOOPNORMAL */ - {sizeof(short[4][3]), "", 0, NULL, NULL, NULL, NULL, NULL, NULL}, + {sizeof(short[4][3]), "", 0, NULL, NULL, NULL, NULL, layerSwap_flnor, NULL}, /* 41: CD_DYNTOPO_NODE */ {sizeof(int), "", 0, NULL, NULL, NULL, NULL, NULL, layerDefault_dyntopo_node}, }; diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c index fe37b9222b6..281e98e7b05 100644 --- a/source/blender/blenkernel/intern/mesh_evaluate.c +++ b/source/blender/blenkernel/intern/mesh_evaluate.c @@ -1236,7 +1236,7 @@ void BKE_mesh_loops_to_tessdata(CustomData *fdata, CustomData *ldata, CustomData float (*lnors)[3] = CustomData_get_layer(ldata, CD_NORMAL); for (findex = 0, lidx = loopindices; findex < num_faces; lidx++, findex++, fnors++) { - for (j = (*lidx)[3] ? 4 : 3; j--;) { + for (j = (mface ? mface[findex].v4 : (*lidx)[3]) ? 4 : 3; j--;) { normal_float_to_short_v3((*fnors)[j], lnors[(*lidx)[j]]); } }