Cleanup: Make format

This commit is contained in:
Hans Goudey 2023-07-24 16:32:08 -04:00
parent 318f9b259b
commit f3f31054ba
13 changed files with 40 additions and 56 deletions

View File

@ -731,8 +731,7 @@ void BKE_mesh_debug_print(const struct Mesh *me) ATTR_NONNULL(1);
*/
BLI_INLINE const int *BKE_mesh_material_indices(const Mesh *mesh)
{
return (const int *)CustomData_get_layer_named(
&mesh->pdata, CD_PROP_INT32, "material_index");
return (const int *)CustomData_get_layer_named(&mesh->pdata, CD_PROP_INT32, "material_index");
}
/**

View File

@ -164,7 +164,8 @@ static void mesh_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int
&mesh_dst->face_offset_indices,
&mesh_dst->runtime->face_offsets_sharing_info);
if (do_tessface) {
CustomData_copy(&mesh_src->fdata_legacy, &mesh_dst->fdata_legacy, mask.fmask, mesh_dst->totface_legacy);
CustomData_copy(
&mesh_src->fdata_legacy, &mesh_dst->fdata_legacy, mask.fmask, mesh_dst->totface_legacy);
}
else {
mesh_tessface_clear_intern(mesh_dst, false);

View File

@ -668,11 +668,8 @@ static void merge_vertex_loop_face_customdata_layers(Mesh *target, MeshesToIMesh
&me->ldata, &target->ldata, CD_MASK_MESH.lmask, CD_SET_DEFAULT, target->totloop);
}
if (me->faces_num) {
CustomData_merge_layout(&me->pdata,
&target->pdata,
CD_MASK_MESH.pmask,
CD_SET_DEFAULT,
target->faces_num);
CustomData_merge_layout(
&me->pdata, &target->pdata, CD_MASK_MESH.pmask, CD_SET_DEFAULT, target->faces_num);
}
}
}

View File

@ -203,8 +203,7 @@ Mesh *BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(MirrorModifierData *mmd,
/* Copy custom data to mirrored geometry. Loops are copied later. */
CustomData_copy_data(&mesh->vdata, &result->vdata, 0, src_verts_num, src_verts_num);
CustomData_copy_data(&mesh->edata, &result->edata, 0, src_edges_num, src_edges_num);
CustomData_copy_data(
&mesh->pdata, &result->pdata, 0, src_faces.size(), src_faces.size());
CustomData_copy_data(&mesh->pdata, &result->pdata, 0, src_faces.size(), src_faces.size());
if (do_vtargetmap) {
/* second half is filled with -1 */

View File

@ -420,23 +420,24 @@ bool BKE_mesh_runtime_is_valid(Mesh *me_eval)
do_fixes,
&changed);
is_valid &= BKE_mesh_validate_arrays(me_eval,
reinterpret_cast<float(*)[3]>(positions.data()),
positions.size(),
edges.data(),
edges.size(),
static_cast<MFace *>(CustomData_get_layer_for_write(
&me_eval->fdata_legacy, CD_MFACE, me_eval->totface_legacy)),
me_eval->totface_legacy,
corner_verts.data(),
corner_edges.data(),
corner_verts.size(),
face_offsets.data(),
me_eval->faces_num,
me_eval->deform_verts_for_write().data(),
do_verbose,
do_fixes,
&changed);
is_valid &= BKE_mesh_validate_arrays(
me_eval,
reinterpret_cast<float(*)[3]>(positions.data()),
positions.size(),
edges.data(),
edges.size(),
static_cast<MFace *>(CustomData_get_layer_for_write(
&me_eval->fdata_legacy, CD_MFACE, me_eval->totface_legacy)),
me_eval->totface_legacy,
corner_verts.data(),
corner_edges.data(),
corner_verts.size(),
face_offsets.data(),
me_eval->faces_num,
me_eval->deform_verts_for_write().data(),
do_verbose,
do_fixes,
&changed);
BLI_assert(changed == false);

View File

@ -702,8 +702,6 @@ static void pbvh_draw_args_init(PBVH *pbvh, PBVH_GPU_Args *args, PBVHNode *node)
args->mesh_grids_num = pbvh->totgrid;
args->node = node;
BKE_pbvh_node_num_verts(pbvh, node, nullptr, &args->node_verts_num);
args->grid_hidden = pbvh->grid_hidden;
args->face_sets_color_default = pbvh->face_sets_color_default;
args->face_sets_color_seed = pbvh->face_sets_color_seed;
@ -723,7 +721,6 @@ static void pbvh_draw_args_init(PBVH *pbvh, PBVH_GPU_Args *args, PBVHNode *node)
switch (pbvh->header.type) {
case PBVH_FACES:
args->mesh_faces_num = pbvh->mesh->faces_num;
args->vdata = pbvh->vdata;
args->ldata = pbvh->ldata;
args->pdata = pbvh->pdata;

View File

@ -111,8 +111,8 @@ static void subdiv_mesh_ctx_cache_custom_data_layers(SubdivMeshContext *ctx)
CustomData_get_layer_for_write(&subdiv_mesh->edata, CD_ORIGINDEX, subdiv_mesh->totedge));
ctx->loop_origindex = static_cast<int *>(
CustomData_get_layer_for_write(&subdiv_mesh->ldata, CD_ORIGINDEX, subdiv_mesh->totloop));
ctx->face_origindex = static_cast<int *>(CustomData_get_layer_for_write(
&subdiv_mesh->pdata, CD_ORIGINDEX, subdiv_mesh->faces_num));
ctx->face_origindex = static_cast<int *>(
CustomData_get_layer_for_write(&subdiv_mesh->pdata, CD_ORIGINDEX, subdiv_mesh->faces_num));
/* UV layers interpolation. */
subdiv_mesh_ctx_cache_uv_layers(ctx);
/* Orco interpolation. */
@ -923,11 +923,8 @@ static void subdiv_mesh_face(const SubdivForeachContext *foreach_context,
{
BLI_assert(coarse_face_index != ORIGINDEX_NONE);
SubdivMeshContext *ctx = static_cast<SubdivMeshContext *>(foreach_context->user_data);
CustomData_copy_data(&ctx->coarse_mesh->pdata,
&ctx->subdiv_mesh->pdata,
coarse_face_index,
subdiv_face_index,
1);
CustomData_copy_data(
&ctx->coarse_mesh->pdata, &ctx->subdiv_mesh->pdata, coarse_face_index, subdiv_face_index, 1);
ctx->subdiv_face_offsets[subdiv_face_index] = start_loop_index;
}

View File

@ -819,8 +819,7 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
if (MAIN_VERSION_FILE_ATLEAST(bmain, 290, 2) && MAIN_VERSION_FILE_OLDER(bmain, 291, 1)) {
/* In this range, the extrude manifold could generate meshes with degenerated face. */
LISTBASE_FOREACH (Mesh *, me, &bmain->meshes) {
const MPoly *polys = static_cast<const MPoly *>(
CustomData_get_layer(&me->pdata, CD_MPOLY));
const MPoly *polys = static_cast<const MPoly *>(CustomData_get_layer(&me->pdata, CD_MPOLY));
for (const int i : blender::IndexRange(me->faces_num)) {
if (polys[i].totloop == 2) {
bool changed;
@ -1209,9 +1208,8 @@ void blo_do_versions_290(FileData *fd, Library * /*lib*/, Main *bmain)
/* We can be sure that mesh->fdata is empty for files written by 2.90. */
mesh->ldata.totlayer = mesh->ldata.maxlayer = MEM_allocN_len(mesh->ldata.layers) /
sizeof(CustomDataLayer);
mesh->pdata.totlayer = mesh->pdata.maxlayer = MEM_allocN_len(
mesh->pdata.layers) /
sizeof(CustomDataLayer);
mesh->pdata.totlayer = mesh->pdata.maxlayer = MEM_allocN_len(mesh->pdata.layers) /
sizeof(CustomDataLayer);
}
}

View File

@ -41,8 +41,7 @@ static void extract_sculpt_data_init(const MeshRenderData *mr,
GPUVertFormat *format = get_sculpt_data_format();
CustomData *cd_vdata = (mr->extract_type == MR_EXTRACT_BMESH) ? &mr->bm->vdata : &mr->me->vdata;
CustomData *cd_pdata = (mr->extract_type == MR_EXTRACT_BMESH) ? &mr->bm->pdata :
&mr->me->pdata;
CustomData *cd_pdata = (mr->extract_type == MR_EXTRACT_BMESH) ? &mr->bm->pdata : &mr->me->pdata;
const float *cd_mask = (const float *)CustomData_get_layer(cd_vdata, CD_PAINT_MASK);
const int *cd_face_set = (const int *)CustomData_get_layer_named(

View File

@ -916,8 +916,7 @@ static void mesh_add_faces(Mesh *mesh, int len)
faces_num = mesh->faces_num + len; /* new face count */
/* update customdata */
CustomData_copy_layout(
&mesh->pdata, &pdata, CD_MASK_MESH.pmask, CD_SET_DEFAULT, faces_num);
CustomData_copy_layout(&mesh->pdata, &pdata, CD_MASK_MESH.pmask, CD_SET_DEFAULT, faces_num);
CustomData_copy_data(&mesh->pdata, &pdata, 0, 0, mesh->faces_num);
implicit_sharing::resize_trivial_array(&mesh->face_offset_indices,

View File

@ -250,14 +250,13 @@ static void join_mesh_single(Depsgraph *depsgraph,
}
}
CustomData_merge_layout(
&me->pdata, pdata, CD_MASK_MESH.pmask, CD_SET_DEFAULT, faces_num);
CustomData_merge_layout(&me->pdata, pdata, CD_MASK_MESH.pmask, CD_SET_DEFAULT, faces_num);
CustomData_copy_data_named(&me->pdata, pdata, 0, *polyofs, me->faces_num);
/* Apply matmap. In case we don't have material indices yet, create them if more than one
* material is the result of joining. */
int *material_indices = static_cast<int *>(CustomData_get_layer_named_for_write(
pdata, CD_PROP_INT32, "material_index", faces_num));
int *material_indices = static_cast<int *>(
CustomData_get_layer_named_for_write(pdata, CD_PROP_INT32, "material_index", faces_num));
if (!material_indices && totcol > 1) {
material_indices = (int *)CustomData_add_layer_named(
pdata, CD_PROP_INT32, CD_SET_DEFAULT, faces_num, "material_index");
@ -1247,8 +1246,7 @@ bool ED_mesh_pick_face_vert(
const blender::OffsetIndices faces = me_eval->faces();
const Span<int> corner_verts = me_eval->corner_verts();
const int *index_mp_to_orig = (const int *)CustomData_get_layer(&me_eval->pdata,
CD_ORIGINDEX);
const int *index_mp_to_orig = (const int *)CustomData_get_layer(&me_eval->pdata, CD_ORIGINDEX);
/* tag all verts using this face */
if (index_mp_to_orig) {

View File

@ -1526,8 +1526,7 @@ static void lineart_identify_mlooptri_feature_edges(void *__restrict userdata,
ff1 = &((FreestyleFace *)me->pdata.layers[index].data)[looptri_faces[i / 3]];
}
if (edge_nabr[i].e > -1) {
ff2 = &(
(FreestyleFace *)me->pdata.layers[index].data)[looptri_faces[edge_nabr[i].e / 3]];
ff2 = &((FreestyleFace *)me->pdata.layers[index].data)[looptri_faces[edge_nabr[i].e / 3]];
}
else {
/* Handle mesh boundary cases: We want mesh boundaries to respect

View File

@ -614,8 +614,8 @@ void MeshImporter::read_polys(COLLADAFW::Mesh *collada_mesh,
MaterialIdPrimitiveArrayMap mat_prim_map;
int *material_indices = BKE_mesh_material_indices_for_write(me);
bool *sharp_faces = static_cast<bool *>(CustomData_get_layer_named_for_write(
&me->pdata, CD_PROP_BOOL, "sharp_face", me->faces_num));
bool *sharp_faces = static_cast<bool *>(
CustomData_get_layer_named_for_write(&me->pdata, CD_PROP_BOOL, "sharp_face", me->faces_num));
if (!sharp_faces) {
sharp_faces = static_cast<bool *>(CustomData_add_layer_named(
&me->pdata, CD_PROP_BOOL, CD_SET_DEFAULT, me->faces_num, "sharp_face"));