[Bf-blender-cvs] [b9e67ee1d6f] refactor-mesh-sharp-face-generic: Cleanup: Rearrange arguments

Hans Goudey noreply at git.blender.org
Tue Jan 10 22:38:48 CET 2023


Commit: b9e67ee1d6ffac24dcb1a3091fb45c092ec18775
Author: Hans Goudey
Date:   Tue Jan 10 16:34:49 2023 -0500
Branches: refactor-mesh-sharp-face-generic
https://developer.blender.org/rBb9e67ee1d6ffac24dcb1a3091fb45c092ec18775

Cleanup: Rearrange arguments

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

M	source/blender/blenkernel/BKE_mesh.h
M	source/blender/blenkernel/intern/data_transfer.cc
M	source/blender/blenkernel/intern/key.cc
M	source/blender/blenkernel/intern/mesh.cc
M	source/blender/blenkernel/intern/mesh_mirror.cc
M	source/blender/blenkernel/intern/mesh_normals.cc
M	source/blender/blenkernel/intern/mesh_remap.cc
M	source/blender/draw/intern/draw_cache_extract_mesh_render_data.cc
M	source/blender/modifiers/intern/MOD_normal_edit.cc
M	source/blender/modifiers/intern/MOD_weighted_normal.cc

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

diff --git a/source/blender/blenkernel/BKE_mesh.h b/source/blender/blenkernel/BKE_mesh.h
index f705248e52e..d96db499892 100644
--- a/source/blender/blenkernel/BKE_mesh.h
+++ b/source/blender/blenkernel/BKE_mesh.h
@@ -609,11 +609,11 @@ void BKE_mesh_normals_loop_split(const float (*vert_positions)[3],
                                  int numLoops,
                                  const struct MPoly *mpolys,
                                  const float (*poly_normals)[3],
-                                 const bool *sharp_faces,
                                  int numPolys,
                                  bool use_split_normals,
                                  float split_angle,
                                  const bool *sharp_edges,
+                                 const bool *sharp_faces,
                                  const int *loop_to_poly_map,
                                  MLoopNorSpaceArray *r_lnors_spacearr,
                                  short (*clnors_data)[2]);
diff --git a/source/blender/blenkernel/intern/data_transfer.cc b/source/blender/blenkernel/intern/data_transfer.cc
index 17da2eb8596..f6f405f7be7 100644
--- a/source/blender/blenkernel/intern/data_transfer.cc
+++ b/source/blender/blenkernel/intern/data_transfer.cc
@@ -290,6 +290,8 @@ static void data_transfer_dtdata_type_preprocess(Mesh *me_src,
     if (dirty_nors_dst || do_loop_nors_dst) {
       const bool *sharp_edges = static_cast<const bool *>(
           CustomData_get_layer_named(&me_dst->edata, CD_PROP_BOOL, "sharp_edge"));
+      const bool *sharp_faces = static_cast<const bool *>(
+          CustomData_get_layer_named(&me_dst->pdata, CD_PROP_BOOL, "sharp_face"));
       BKE_mesh_normals_loop_split(positions_dst,
                                   BKE_mesh_vertex_normals_ensure(me_dst),
                                   num_verts_dst,
@@ -300,12 +302,11 @@ static void data_transfer_dtdata_type_preprocess(Mesh *me_src,
                                   num_loops_dst,
                                   polys_dst,
                                   BKE_mesh_poly_normals_ensure(me_dst),
-                                  static_cast<const bool *>(CustomData_get_layer_named(
-                                      &me_dst->pdata, CD_PROP_BOOL, "sharp_face")),
                                   num_polys_dst,
                                   use_split_nors_dst,
                                   split_angle_dst,
                                   sharp_edges,
+                                  sharp_faces,
                                   nullptr,
                                   nullptr,
                                   custom_nors_dst);
diff --git a/source/blender/blenkernel/intern/key.cc b/source/blender/blenkernel/intern/key.cc
index fdea39fef67..3f17416e1e6 100644
--- a/source/blender/blenkernel/intern/key.cc
+++ b/source/blender/blenkernel/intern/key.cc
@@ -2276,6 +2276,8 @@ void BKE_keyblock_mesh_calc_normals(const KeyBlock *kb,
         CustomData_get_layer(&mesh->ldata, CD_CUSTOMLOOPNORMAL)); /* May be nullptr. */
     const bool *sharp_edges = static_cast<const bool *>(
         CustomData_get_layer_named(&mesh->edata, CD_PROP_BOOL, "sharp_edge"));
+    const bool *sharp_faces = static_cast<const bool *>(
+        CustomData_get_layer_named(&mesh->pdata, CD_PROP_BOOL, "sharp_face"));
     BKE_mesh_normals_loop_split(positions,
                                 vert_normals,
                                 mesh->totvert,
@@ -2286,12 +2288,11 @@ void BKE_keyblock_mesh_calc_normals(const KeyBlock *kb,
                                 mesh->totloop,
                                 polys,
                                 poly_normals,
-                                static_cast<const bool *>(CustomData_get_layer_named(
-                                    &mesh->pdata, CD_PROP_BOOL, "sharp_face")),
                                 mesh->totpoly,
                                 (mesh->flag & ME_AUTOSMOOTH) != 0,
                                 mesh->smoothresh,
                                 sharp_edges,
+                                sharp_faces,
                                 nullptr,
                                 nullptr,
                                 clnors);
diff --git a/source/blender/blenkernel/intern/mesh.cc b/source/blender/blenkernel/intern/mesh.cc
index 8277fa13b81..b0fbfbf1a5e 100644
--- a/source/blender/blenkernel/intern/mesh.cc
+++ b/source/blender/blenkernel/intern/mesh.cc
@@ -1844,7 +1844,8 @@ void BKE_mesh_calc_normals_split_ex(Mesh *mesh,
   short(*clnors)[2] = (short(*)[2])CustomData_get_layer(&mesh->ldata, CD_CUSTOMLOOPNORMAL);
   const bool *sharp_edges = static_cast<const bool *>(
       CustomData_get_layer_named(&mesh->edata, CD_PROP_BOOL, "sharp_edge"));
-
+  const bool *sharp_faces = static_cast<const bool *>(
+      CustomData_get_layer_named(&mesh->pdata, CD_PROP_BOOL, "sharp_face"));
   const Span<float3> positions = mesh->vert_positions();
   const Span<MEdge> edges = mesh->edges();
   const Span<MPoly> polys = mesh->polys();
@@ -1860,12 +1861,11 @@ void BKE_mesh_calc_normals_split_ex(Mesh *mesh,
                               loops.size(),
                               polys.data(),
                               BKE_mesh_poly_normals_ensure(mesh),
-                              static_cast<const bool *>(CustomData_get_layer_named(
-                                  &mesh->pdata, CD_PROP_BOOL, "sharp_face")),
                               polys.size(),
                               use_split_normals,
                               split_angle,
                               sharp_edges,
+                              sharp_faces,
                               nullptr,
                               r_lnors_spacearr,
                               clnors);
diff --git a/source/blender/blenkernel/intern/mesh_mirror.cc b/source/blender/blenkernel/intern/mesh_mirror.cc
index da03fbc4266..8c5903da999 100644
--- a/source/blender/blenkernel/intern/mesh_mirror.cc
+++ b/source/blender/blenkernel/intern/mesh_mirror.cc
@@ -410,6 +410,8 @@ Mesh *BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(MirrorModifierData *mmd,
 
     const bool *sharp_edges = static_cast<const bool *>(
         CustomData_get_layer_named(&mesh->edata, CD_PROP_BOOL, "sharp_edge"));
+    const bool *sharp_faces = static_cast<const bool *>(
+        CustomData_get_layer_named(&result->pdata, CD_PROP_BOOL, "sharp_face"));
     BKE_mesh_normals_loop_split(BKE_mesh_vert_positions(result),
                                 BKE_mesh_vertex_normals_ensure(result),
                                 result->totvert,
@@ -420,12 +422,11 @@ Mesh *BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(MirrorModifierData *mmd,
                                 totloop,
                                 BKE_mesh_polys(result),
                                 BKE_mesh_poly_normals_ensure(result),
-                                static_cast<const bool *>(CustomData_get_layer_named(
-                                    &result->pdata, CD_PROP_BOOL, "sharp_face")),
                                 totpoly,
                                 true,
                                 mesh->smoothresh,
                                 sharp_edges,
+                                sharp_faces,
                                 nullptr,
                                 &lnors_spacearr,
                                 clnors);
diff --git a/source/blender/blenkernel/intern/mesh_normals.cc b/source/blender/blenkernel/intern/mesh_normals.cc
index b1463204ce8..726437400e8 100644
--- a/source/blender/blenkernel/intern/mesh_normals.cc
+++ b/source/blender/blenkernel/intern/mesh_normals.cc
@@ -1451,11 +1451,11 @@ void BKE_mesh_normals_loop_split(const float (*vert_positions)[3],
                                  const int numLoops,
                                  const MPoly *mpolys,
                                  const float (*poly_normals)[3],
-                                 const bool *sharp_faces,
                                  const int numPolys,
                                  const bool use_split_normals,
                                  const float split_angle,
                                  const bool *sharp_edges,
+                                 const bool *sharp_faces,
                                  const int *loop_to_poly_map,
                                  MLoopNorSpaceArray *r_lnors_spacearr,
                                  short (*clnors_data)[2])
@@ -1659,11 +1659,11 @@ static void mesh_normals_loop_custom_set(const float (*positions)[3],
                               numLoops,
                               mpolys,
                               poly_normals,
-                              sharp_faces,
                               numPolys,
                               use_split_normals,
                               split_angle,
                               sharp_edges.data(),
+                              sharp_faces,
                               loop_to_poly.data(),
                               &lnors_spacearr,
                               nullptr);
@@ -1788,11 +1788,11 @@ static void mesh_normals_loop_custom_set(const float (*positions)[3],
                                 numLoops,
                                 mpolys,
                                 poly_normals,
-                                sharp_faces,
                                 numPolys,
                                 use_split_normals,
                                 split_angle,
                                 sharp_edges.data(),
+                                sharp_faces,
                                 loop_to_poly.data(),
                                 &lnors_spacearr,
                                 nullptr);
diff --git a/source/blender/blenkernel/intern/mesh_remap.cc b/source/blender/blenkernel/intern/mesh_remap.cc
index c761f8284c3..08918a26b57 100644
--- a/source/blender/blenkernel/intern/mesh_remap.cc
+++ b/source/blender/blenkernel/intern/mesh_remap.cc
@@ -1370,6 +1370,8 @@ void BKE_mesh_remap_calc_loops_from_mesh(const int mode,
         if (dirty_nors_dst || do_loop_nors_dst) {
           const bool *sharp_edges = stat

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list