Fix T50534: Part I, cleanup loop normals generated during modifier stack evaluation.
Those could stay around, and be displayed in 3DView even when autosmooth was disabled (but would not be 'active').
This commit is contained in:
parent
bfe3b967fa
commit
fb2f95c91a
Notes:
blender-bot
2023-02-14 10:09:24 +01:00
Referenced by issue #50534, exported normals do not correspond with normals shown in viewport
|
@ -2215,6 +2215,12 @@ static void mesh_calc_modifiers(
|
|||
}
|
||||
}
|
||||
|
||||
/* Some modifiers, like datatransfer, may generate those data as temp layer, we do not want to keep them,
|
||||
* as they are used by display code when available (i.e. even if autosmooth is disabled). */
|
||||
if (!do_loop_normals && CustomData_has_layer(&finaldm->loopData, CD_NORMAL)) {
|
||||
CustomData_free_layers(&finaldm->loopData, CD_NORMAL, finaldm->numLoopData);
|
||||
}
|
||||
|
||||
#ifdef WITH_GAMEENGINE
|
||||
/* NavMesh - this is a hack but saves having a NavMesh modifier */
|
||||
if ((ob->gameflag & OB_NAVMESH) && (finaldm->type == DM_TYPE_CDDM)) {
|
||||
|
@ -2550,6 +2556,15 @@ static void editbmesh_calc_modifiers(
|
|||
/* same as mesh_calc_modifiers (if using loop normals, poly nors have already been computed). */
|
||||
if (!do_loop_normals) {
|
||||
dm_ensure_display_normals(*r_final);
|
||||
|
||||
/* Some modifiers, like datatransfer, may generate those data, we do not want to keep them,
|
||||
* as they are used by display code when available (i.e. even if autosmooth is disabled). */
|
||||
if (CustomData_has_layer(&(*r_final)->loopData, CD_NORMAL)) {
|
||||
CustomData_free_layers(&(*r_final)->loopData, CD_NORMAL, (*r_final)->numLoopData);
|
||||
}
|
||||
if (r_cage && CustomData_has_layer(&(*r_cage)->loopData, CD_NORMAL)) {
|
||||
CustomData_free_layers(&(*r_cage)->loopData, CD_NORMAL, (*r_cage)->numLoopData);
|
||||
}
|
||||
}
|
||||
|
||||
/* add an orco layer if needed */
|
||||
|
|
Loading…
Reference in New Issue