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:
authorBrecht Van Lommel <brecht@blender.org>2022-04-06 21:02:04 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-04-07 20:48:54 +0300
commit51a7e4b488a4df1ce6fec93ee599d70efdbf5e03 (patch)
treee8447cf1e85c3305a0b8b12f1bfeb08a303f5278
parentbe799749dcc886e9e47493cb34eaf0367894d979 (diff)
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
-rw-r--r--source/blender/blenkernel/intern/DerivedMesh.cc54
1 files changed, 16 insertions, 38 deletions
diff --git a/source/blender/blenkernel/intern/DerivedMesh.cc b/source/blender/blenkernel/intern/DerivedMesh.cc
index 604cc3682f0..33f0c331e46 100644
--- a/source/blender/blenkernel/intern/DerivedMesh.cc
+++ b/source/blender/blenkernel/intern/DerivedMesh.cc
@@ -631,30 +631,23 @@ static void mesh_calc_modifier_final_normals(const Mesh *mesh_input,
if (do_loop_normals) {
/* Compute loop normals (NOTE: will compute poly and vert normals as well, if needed!). */
BKE_mesh_calc_normals_split(mesh_final);
- BKE_mesh_tessface_clear(mesh_final);
}
-
- if (sculpt_dyntopo == false) {
- /* watch this! after 2.75a we move to from tessface to looptri (by default) */
- if (final_datamask->fmask & CD_MASK_MFACE) {
- BKE_mesh_tessface_ensure(mesh_final);
- }
-
- /* 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) {
+ else {
+ if (sculpt_dyntopo == false) {
+ /* 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. */
BKE_mesh_ensure_normals_for_display(mesh_final);
}
- }
- /* 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
- * (i.e. even if autosmooth is disabled). */
- if (!do_loop_normals && CustomData_has_layer(&mesh_final->ldata, CD_NORMAL)) {
- CustomData_free_layers(&mesh_final->ldata, CD_NORMAL, mesh_final->totloop);
+ /* 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
+ * (i.e. even if autosmooth is disabled). */
+ if (CustomData_has_layer(&mesh_final->ldata, CD_NORMAL)) {
+ 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. */
if (is_own_mesh) {
mesh_calc_modifier_final_normals(mesh_input, &final_datamask, sculpt_dyntopo, mesh_final);
+ mesh_calc_finalize(mesh_input, mesh_final);
}
else {
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 */
*r_final = mesh_final;
if (r_deform) {
@@ -1299,21 +1289,9 @@ static void editbmesh_calc_modifier_final_normals(Mesh *mesh_final,
if (do_loop_normals) {
/* Compute loop normals */
BKE_mesh_calc_normals_split(mesh_final);
- BKE_mesh_tessface_clear(mesh_final);
}
-
- /* BMESH_ONLY, ensure tessface's used for drawing,
- * 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) {
+ else {
+ /* Same as mesh_calc_modifiers. If using loop normals, poly nors have already been computed. */
BKE_mesh_ensure_normals_for_display(mesh_final);
/* Some modifiers, like data-transfer, may generate those data, we do not want to keep them,