Cleanup: remove unused mface tesselation code from modifier stack
This seems to serve no purpose anymore, I don't see anywhere that CD_MFACE is requested for modifier evaluation, and it's confusing to have this in this final normals computation function. Found while looking into D14579. Differential Revision: https://developer.blender.org/D14580
This commit is contained in:
@@ -631,30 +631,23 @@ static void mesh_calc_modifier_final_normals(const Mesh *mesh_input,
|
|||||||
if (do_loop_normals) {
|
if (do_loop_normals) {
|
||||||
/* Compute loop normals (NOTE: will compute poly and vert normals as well, if needed!). */
|
/* Compute loop normals (NOTE: will compute poly and vert normals as well, if needed!). */
|
||||||
BKE_mesh_calc_normals_split(mesh_final);
|
BKE_mesh_calc_normals_split(mesh_final);
|
||||||
BKE_mesh_tessface_clear(mesh_final);
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
if (sculpt_dyntopo == false) {
|
if (sculpt_dyntopo == false) {
|
||||||
/* watch this! after 2.75a we move to from tessface to looptri (by default) */
|
/* without this, drawing ngon tri's faces will show ugly tessellated face
|
||||||
if (final_datamask->fmask & CD_MASK_MFACE) {
|
* normals and will also have to calculate normals on the fly, try avoid
|
||||||
BKE_mesh_tessface_ensure(mesh_final);
|
* this where possible since calculating polygon normals isn't fast,
|
||||||
}
|
* note that this isn't a problem for subsurf (only quads) or editmode
|
||||||
|
* which deals with drawing differently. */
|
||||||
/* without this, drawing ngon tri's faces will show ugly tessellated face
|
|
||||||
* normals and will also have to calculate normals on the fly, try avoid
|
|
||||||
* this where possible since calculating polygon normals isn't fast,
|
|
||||||
* note that this isn't a problem for subsurf (only quads) or editmode
|
|
||||||
* which deals with drawing differently. */
|
|
||||||
if (!do_loop_normals) {
|
|
||||||
BKE_mesh_ensure_normals_for_display(mesh_final);
|
BKE_mesh_ensure_normals_for_display(mesh_final);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/* Some modifiers, like data-transfer, may generate those data as temp layer,
|
/* Some modifiers, like data-transfer, may generate those data as temp layer,
|
||||||
* we do not want to keep them, as they are used by display code when available
|
* we do not want to keep them, as they are used by display code when available
|
||||||
* (i.e. even if autosmooth is disabled). */
|
* (i.e. even if autosmooth is disabled). */
|
||||||
if (!do_loop_normals && CustomData_has_layer(&mesh_final->ldata, CD_NORMAL)) {
|
if (CustomData_has_layer(&mesh_final->ldata, CD_NORMAL)) {
|
||||||
CustomData_free_layers(&mesh_final->ldata, CD_NORMAL, mesh_final->totloop);
|
CustomData_free_layers(&mesh_final->ldata, CD_NORMAL, mesh_final->totloop);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1196,6 +1189,7 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
|
|||||||
/* Compute normals. */
|
/* Compute normals. */
|
||||||
if (is_own_mesh) {
|
if (is_own_mesh) {
|
||||||
mesh_calc_modifier_final_normals(mesh_input, &final_datamask, sculpt_dyntopo, mesh_final);
|
mesh_calc_modifier_final_normals(mesh_input, &final_datamask, sculpt_dyntopo, mesh_final);
|
||||||
|
mesh_calc_finalize(mesh_input, mesh_final);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Mesh_Runtime *runtime = &mesh_input->runtime;
|
Mesh_Runtime *runtime = &mesh_input->runtime;
|
||||||
@@ -1232,10 +1226,6 @@ static void mesh_calc_modifiers(struct Depsgraph *depsgraph,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_own_mesh) {
|
|
||||||
mesh_calc_finalize(mesh_input, mesh_final);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Return final mesh */
|
/* Return final mesh */
|
||||||
*r_final = mesh_final;
|
*r_final = mesh_final;
|
||||||
if (r_deform) {
|
if (r_deform) {
|
||||||
@@ -1299,21 +1289,9 @@ static void editbmesh_calc_modifier_final_normals(Mesh *mesh_final,
|
|||||||
if (do_loop_normals) {
|
if (do_loop_normals) {
|
||||||
/* Compute loop normals */
|
/* Compute loop normals */
|
||||||
BKE_mesh_calc_normals_split(mesh_final);
|
BKE_mesh_calc_normals_split(mesh_final);
|
||||||
BKE_mesh_tessface_clear(mesh_final);
|
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
/* BMESH_ONLY, ensure tessface's used for drawing,
|
/* Same as mesh_calc_modifiers. If using loop normals, poly nors have already been computed. */
|
||||||
* but don't recalculate if the last modifier in the stack gives us tessfaces
|
|
||||||
* check if the derived meshes are DM_TYPE_EDITBMESH before calling, this isn't essential
|
|
||||||
* but quiets annoying error messages since tessfaces won't be created. */
|
|
||||||
if (final_datamask->fmask & CD_MASK_MFACE) {
|
|
||||||
if (mesh_final->edit_mesh == nullptr) {
|
|
||||||
BKE_mesh_tessface_ensure(mesh_final);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* same as mesh_calc_modifiers (if using loop normals, poly nors have already been computed). */
|
|
||||||
if (!do_loop_normals) {
|
|
||||||
BKE_mesh_ensure_normals_for_display(mesh_final);
|
BKE_mesh_ensure_normals_for_display(mesh_final);
|
||||||
|
|
||||||
/* Some modifiers, like data-transfer, may generate those data, we do not want to keep them,
|
/* Some modifiers, like data-transfer, may generate those data, we do not want to keep them,
|
||||||
|
Reference in New Issue
Block a user