Cleanup: Rearrange arguments

This commit is contained in:
Hans Goudey 2023-01-10 16:38:41 -05:00
parent 79e600f75e
commit 6b32a9a956
6 changed files with 11 additions and 9 deletions

View File

@ -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);

View File

@ -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"));
}

View File

@ -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)
{

View File

@ -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());

View File

@ -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);
}

View File

@ -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);
}