[Bf-blender-cvs] [6b32a9a956d] refactor-mesh-sharp-face-generic: Cleanup: Rearrange arguments
Hans Goudey
noreply at git.blender.org
Tue Jan 10 22:38:49 CET 2023
Commit: 6b32a9a956d5e0f9e64d65be834f45220839fb56
Author: Hans Goudey
Date: Tue Jan 10 16:38:41 2023 -0500
Branches: refactor-mesh-sharp-face-generic
https://developer.blender.org/rB6b32a9a956d5e0f9e64d65be834f45220839fb56
Cleanup: Rearrange arguments
===================================================================
M source/blender/blenkernel/BKE_mesh_mapping.h
M source/blender/blenkernel/intern/mesh_legacy_convert.cc
M source/blender/blenkernel/intern/mesh_mapping.cc
M source/blender/editors/mesh/mesh_data.cc
M source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
M source/blender/makesrna/intern/rna_mesh_api.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_mesh_mapping.h b/source/blender/blenkernel/BKE_mesh_mapping.h
index 6e415e03f95..c8561372e30 100644
--- a/source/blender/blenkernel/BKE_mesh_mapping.h
+++ b/source/blender/blenkernel/BKE_mesh_mapping.h
@@ -319,11 +319,11 @@ bool BKE_mesh_calc_islands_loop_poly_uvmap(float (*vert_positions)[3],
int *BKE_mesh_calc_smoothgroups(const struct MEdge *medge,
int totedge,
const struct MPoly *mpoly,
- const bool *sharp_faces,
int totpoly,
const struct MLoop *mloop,
int totloop,
const bool *sharp_edges,
+ const bool *sharp_faces,
int *r_totgroup,
bool use_bitflags);
diff --git a/source/blender/blenkernel/intern/mesh_legacy_convert.cc b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
index 0bc28698aee..7083c9880de 100644
--- a/source/blender/blenkernel/intern/mesh_legacy_convert.cc
+++ b/source/blender/blenkernel/intern/mesh_legacy_convert.cc
@@ -450,7 +450,7 @@ static void convert_mfaces_to_mpolys(ID *id,
}
bool *sharp_faces = static_cast<bool *>(
CustomData_get_layer_named(pdata, CD_PROP_BOOL, "sharp_face"));
- if (sharp_faces == nullptr) {
+ if (!sharp_faces) {
sharp_faces = static_cast<bool *>(CustomData_add_layer_named(
pdata, CD_PROP_BOOL, CD_SET_DEFAULT, nullptr, totpoly, "sharp_face"));
}
diff --git a/source/blender/blenkernel/intern/mesh_mapping.cc b/source/blender/blenkernel/intern/mesh_mapping.cc
index 4460465a50b..76534a9de2b 100644
--- a/source/blender/blenkernel/intern/mesh_mapping.cc
+++ b/source/blender/blenkernel/intern/mesh_mapping.cc
@@ -871,11 +871,11 @@ static bool poly_is_island_boundary_smooth_cb(const int poly_index,
int *BKE_mesh_calc_smoothgroups(const MEdge *medge,
const int totedge,
const MPoly *mpoly,
- const bool *sharp_faces,
const int totpoly,
const MLoop *mloop,
const int totloop,
const bool *sharp_edges,
+ const bool *sharp_faces,
int *r_totgroup,
const bool use_bitflags)
{
diff --git a/source/blender/editors/mesh/mesh_data.cc b/source/blender/editors/mesh/mesh_data.cc
index 835fa5f6c1e..e2cb1286356 100644
--- a/source/blender/editors/mesh/mesh_data.cc
+++ b/source/blender/editors/mesh/mesh_data.cc
@@ -868,13 +868,14 @@ static int mesh_customdata_custom_splitnormals_add_exec(bContext *C, wmOperator
bke::MutableAttributeAccessor attributes = me->attributes_for_write();
bke::SpanAttributeWriter<bool> sharp_edges = attributes.lookup_or_add_for_write_span<bool>(
"sharp_edge", ATTR_DOMAIN_EDGE);
+ const bool *sharp_faces = static_cast<const bool *>(
+ CustomData_get_layer_named(&me->pdata, CD_PROP_BOOL, "sharp_face"));
BKE_edges_sharp_from_angle_set(me->totedge,
loops.data(),
loops.size(),
polys.data(),
BKE_mesh_poly_normals_ensure(me),
- static_cast<const bool *>(CustomData_get_layer_named(
- &me->pdata, CD_PROP_BOOL, "sharp_face")),
+ sharp_faces,
polys.size(),
me->smoothresh,
sharp_edges.span.data());
@@ -1542,13 +1543,14 @@ void ED_mesh_split_faces(Mesh *mesh)
const float split_angle = (mesh->flag & ME_AUTOSMOOTH) != 0 ? mesh->smoothresh : float(M_PI);
Array<bool> sharp_edges(mesh->totedge, false);
+ const bool *sharp_faces_ptr = static_cast<const bool *>(
+ CustomData_get_layer_named(&mesh->pdata, CD_PROP_BOOL, "sharp_face"));
BKE_edges_sharp_from_angle_set(mesh->totedge,
loops.data(),
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")),
+ sharp_faces_ptr,
polys.size(),
split_angle,
sharp_edges.data());
diff --git a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
index 97d8276071e..76732ce8326 100644
--- a/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
+++ b/source/blender/io/wavefront_obj/exporter/obj_export_mesh.cc
@@ -203,11 +203,11 @@ void OBJMesh::calc_smooth_groups(const bool use_bitflags)
poly_smooth_groups_ = BKE_mesh_calc_smoothgroups(mesh_edges_.data(),
mesh_edges_.size(),
mesh_polys_.data(),
- sharp_faces,
mesh_polys_.size(),
mesh_loops_.data(),
mesh_loops_.size(),
sharp_edges,
+ sharp_faces,
&tot_smooth_groups_,
use_bitflags);
}
diff --git a/source/blender/makesrna/intern/rna_mesh_api.c b/source/blender/makesrna/intern/rna_mesh_api.c
index c5bb1841189..12138705641 100644
--- a/source/blender/makesrna/intern/rna_mesh_api.c
+++ b/source/blender/makesrna/intern/rna_mesh_api.c
@@ -99,10 +99,10 @@ static void rna_Mesh_calc_smooth_groups(
mesh->totedge,
BKE_mesh_polys(mesh),
mesh->totpoly,
- sharp_faces,
BKE_mesh_loops(mesh),
mesh->totloop,
sharp_edges,
+ sharp_faces,
r_group_total,
use_bitflags);
}
More information about the Bf-blender-cvs
mailing list