[Bf-blender-cvs] [ef0e21f0ae7] blender-v3.1-release: Cleanup: Remove unused argument to mesh tessellation

Hans Goudey noreply at git.blender.org
Fri Feb 18 20:39:24 CET 2022


Commit: ef0e21f0ae71d9ec4ba3cdf6f6a16c9575459ced
Author: Hans Goudey
Date:   Fri Feb 18 13:39:16 2022 -0600
Branches: blender-v3.1-release
https://developer.blender.org/rBef0e21f0ae71d9ec4ba3cdf6f6a16c9575459ced

Cleanup: Remove unused argument to mesh tessellation

This removes manual handling of normals that was hard-coded
to false in the one place the function was called. This change
will help to make a fix to T95839 simpler.

===================================================================

M	source/blender/blenkernel/BKE_mesh.h
M	source/blender/blenkernel/intern/mesh_tessellate.c

===================================================================

diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index 376bb5c8d2e..2b32c6a5420 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -348,8 +348,7 @@ int BKE_mesh_tessface_calc_ex(struct CustomData *fdata,
                               struct MVert *mvert,
                               int totface,
                               int totloop,
-                              int totpoly,
-                              bool do_face_nor_copy);
+                              int totpoly);
 void BKE_mesh_tessface_calc(struct Mesh *mesh);
 
 /**
diff --git a/source/blender/blenkernel/intern/mesh_tessellate.c b/source/blender/blenkernel/intern/mesh_tessellate.c
index 241aefc418c..4c4e008f615 100644
--- a/source/blender/blenkernel/intern/mesh_tessellate.c
+++ b/source/blender/blenkernel/intern/mesh_tessellate.c
@@ -160,8 +160,7 @@ int BKE_mesh_tessface_calc_ex(CustomData *fdata,
                               MVert *mvert,
                               int totface,
                               int totloop,
-                              int totpoly,
-                              const bool do_face_nor_copy)
+                              int totpoly)
 {
 #define USE_TESSFACE_SPEEDUP
 #define USE_TESSFACE_QUADS
@@ -363,18 +362,6 @@ int BKE_mesh_tessface_calc_ex(CustomData *fdata,
   CustomData_add_layer(fdata, CD_ORIGINDEX, CD_ASSIGN, mface_to_poly_map, totface);
   CustomData_from_bmeshpoly(fdata, ldata, totface);
 
-  if (do_face_nor_copy) {
-    /* If polys have a normals layer, copying that to faces can help
-     * avoid the need to recalculate normals later. */
-    if (CustomData_has_layer(pdata, CD_NORMAL)) {
-      float(*pnors)[3] = CustomData_get_layer(pdata, CD_NORMAL);
-      float(*fnors)[3] = CustomData_add_layer(fdata, CD_NORMAL, CD_CALLOC, NULL, totface);
-      for (mface_index = 0; mface_index < totface; mface_index++) {
-        copy_v3_v3(fnors[mface_index], pnors[mface_to_poly_map[mface_index]]);
-      }
-    }
-  }
-
   /* NOTE: quad detection issue - fourth vertidx vs fourth loopidx:
    * Polygons take care of their loops ordering, hence not of their vertices ordering.
    * Currently, our tfaces' fourth vertex index might be 0 even for a quad.
@@ -411,16 +398,13 @@ int BKE_mesh_tessface_calc_ex(CustomData *fdata,
 
 void BKE_mesh_tessface_calc(Mesh *mesh)
 {
-  mesh->totface = BKE_mesh_tessface_calc_ex(
-      &mesh->fdata,
-      &mesh->ldata,
-      &mesh->pdata,
-      mesh->mvert,
-      mesh->totface,
-      mesh->totloop,
-      mesh->totpoly,
-      /* Calculate normals right after, don't copy from polys here. */
-      false);
+  mesh->totface = BKE_mesh_tessface_calc_ex(&mesh->fdata,
+                                            &mesh->ldata,
+                                            &mesh->pdata,
+                                            mesh->mvert,
+                                            mesh->totface,
+                                            mesh->totloop,
+                                            mesh->totpoly);
 
   BKE_mesh_update_customdata_pointers(mesh, true);
 }



More information about the Bf-blender-cvs mailing list