Cleanup: right shift arguments
authorCampbell Barton <ideasman42@gmail.com>
Fri, 13 Jul 2018 06:36:10 +0000 (08:36 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Fri, 13 Jul 2018 06:36:10 +0000 (08:36 +0200)
source/blender/blenkernel/intern/mesh.c
source/blender/blenkernel/intern/mesh_convert.c
source/blender/blenkernel/intern/mesh_evaluate.c
source/blender/blenkernel/intern/mesh_mapping.c
source/blender/blenkernel/intern/mesh_remap.c
source/blender/blenkernel/intern/mesh_validate.c

index 4fabf9ebdf87dcaeda4c158026c8189847ea5c97..6d4814720741a5b7463ce539e7d5e1760a10409c 100644 (file)
@@ -347,8 +347,9 @@ void BKE_mesh_ensure_skin_customdata(Mesh *me)
 
                        /* Mark an arbitrary vertex as root */
                        BM_ITER_MESH (v, &iter, bm, BM_VERTS_OF_MESH) {
-                               vs = CustomData_bmesh_get(&bm->vdata, v->head.data,
-                                                         CD_MVERT_SKIN);
+                               vs = CustomData_bmesh_get(
+                                       &bm->vdata, v->head.data,
+                                       CD_MVERT_SKIN);
                                vs->flag |= MVERT_SKIN_ROOT;
                                break;
                        }
@@ -356,11 +357,12 @@ void BKE_mesh_ensure_skin_customdata(Mesh *me)
        }
        else {
                if (!CustomData_has_layer(&me->vdata, CD_MVERT_SKIN)) {
-                       vs = CustomData_add_layer(&me->vdata,
-                                                 CD_MVERT_SKIN,
-                                                 CD_DEFAULT,
-                                                 NULL,
-                                                 me->totvert);
+                       vs = CustomData_add_layer(
+                               &me->vdata,
+                               CD_MVERT_SKIN,
+                               CD_DEFAULT,
+                               NULL,
+                               me->totvert);
 
                        /* Mark an arbitrary vertex as root */
                        if (vs) {
@@ -550,8 +552,9 @@ void BKE_mesh_make_local(Main *bmain, Mesh *me, const bool lib_local)
        BKE_id_make_local_generic(bmain, &me->id, true, lib_local);
 }
 
-bool BKE_mesh_uv_cdlayer_rename_index(Mesh *me, const int poly_index, const int loop_index, const int face_index,
-                                      const char *new_name, const bool do_tessface)
+bool BKE_mesh_uv_cdlayer_rename_index(
+        Mesh *me, const int poly_index, const int loop_index, const int face_index,
+        const char *new_name, const bool do_tessface)
 {
        CustomData *pdata, *ldata, *fdata;
        CustomDataLayer *cdlp, *cdlu, *cdlf;
@@ -1037,9 +1040,10 @@ int poly_get_adj_loops_from_vert(
         const MLoop *mloop, unsigned int vert,
         unsigned int r_adj[2])
 {
-       int corner = poly_find_loop_from_vert(poly,
-                                             &mloop[poly->loopstart],
-                                             vert);
+       int corner = poly_find_loop_from_vert(
+               poly,
+               &mloop[poly->loopstart],
+               vert);
 
        if (corner != -1) {
 #if 0  /* unused - this loop */
@@ -1147,11 +1151,12 @@ void BKE_mesh_ensure_navmesh(Mesh *me)
 
 void BKE_mesh_tessface_calc(Mesh *mesh)
 {
-       mesh->totface = BKE_mesh_recalc_tessellation(&mesh->fdata, &mesh->ldata, &mesh->pdata,
-                                                    mesh->mvert,
-                                                    mesh->totface, mesh->totloop, mesh->totpoly,
-                                                    /* calc normals right after, don't copy from polys here */
-                                                    false);
+       mesh->totface = BKE_mesh_recalc_tessellation(
+               &mesh->fdata, &mesh->ldata, &mesh->pdata,
+               mesh->mvert,
+               mesh->totface, mesh->totloop, mesh->totpoly,
+               /* calc normals right after, don't copy from polys here */
+               false);
 
        BKE_mesh_update_customdata_pointers(mesh, true);
 }
@@ -1370,8 +1375,8 @@ void BKE_mesh_calc_normals_split_ex(Mesh *mesh, MLoopNorSpaceArray *r_lnors_spac
        else {
                polynors = MEM_malloc_arrayN(mesh->totpoly, sizeof(float[3]), __func__);
                BKE_mesh_calc_normals_poly(
-                           mesh->mvert, NULL, mesh->totvert,
-                           mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly, polynors, false);
+                       mesh->mvert, NULL, mesh->totvert,
+                       mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly, polynors, false);
                free_polynors = true;
        }
 
@@ -1650,8 +1655,9 @@ void BKE_mesh_split_faces(Mesh *mesh, bool free_loop_normals)
 
 /* **** Depsgraph evaluation **** */
 
-void BKE_mesh_eval_geometry(EvaluationContext *UNUSED(eval_ctx),
-                            Mesh *mesh)
+void BKE_mesh_eval_geometry(
+        EvaluationContext *UNUSED(eval_ctx),
+        Mesh *mesh)
 {
        DEG_debug_print_eval(__func__, mesh->id.name, mesh);
        if (mesh->bb == NULL || (mesh->bb->flag & BOUNDBOX_DIRTY)) {
index d376c90f1c2c8ade47512ff473ea8fdd7b684e20..c801c5dcb01646b4464b61ee720b548f081cd1fd 100644 (file)
@@ -123,9 +123,10 @@ void BKE_mesh_from_metaball(ListBase *lb, Mesh *me)
 /**
  * Specialized function to use when we _know_ existing edges don't overlap with poly edges.
  */
-static void make_edges_mdata_extend(MEdge **r_alledge, int *r_totedge,
-                                    const MPoly *mpoly, MLoop *mloop,
-                                    const int totpoly)
+static void make_edges_mdata_extend(
+        MEdge **r_alledge, int *r_totedge,
+        const MPoly *mpoly, MLoop *mloop,
+        const int totpoly)
 {
        int totedge = *r_totedge;
        int totedge_new;
@@ -498,10 +499,11 @@ void BKE_mesh_from_nurbs_displist(
        cu = ob->data;
 
        if (dm == NULL) {
-               if (BKE_mesh_nurbs_displist_to_mdata(ob, dispbase, &allvert, &totvert,
-                                                    &alledge, &totedge, &allloop,
-                                                    &allpoly, (use_orco_uv) ? &alluv : NULL,
-                                                    &totloop, &totpoly) != 0)
+               if (BKE_mesh_nurbs_displist_to_mdata(
+                           ob, dispbase, &allvert, &totvert,
+                           &alledge, &totedge, &allloop,
+                           &allpoly, (use_orco_uv) ? &alluv : NULL,
+                           &totloop, &totpoly) != 0)
                {
                        /* Error initializing */
                        return;
index 6a3d74aec649f15e4ba0eb0003a776cf5599fe32..279ab7775292934854bcc5bc64c63313a159f752 100644 (file)
@@ -337,9 +337,10 @@ void BKE_mesh_calc_normals(Mesh *mesh)
 #ifdef DEBUG_TIME
        TIMEIT_START_AVERAGED(BKE_mesh_calc_normals);
 #endif
-       BKE_mesh_calc_normals_poly(mesh->mvert, NULL, mesh->totvert,
-                                  mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly,
-                                  NULL, false);
+       BKE_mesh_calc_normals_poly(
+               mesh->mvert, NULL, mesh->totvert,
+               mesh->mloop, mesh->mpoly, mesh->totloop, mesh->totpoly,
+               NULL, false);
 #ifdef DEBUG_TIME
        TIMEIT_END_AVERAGED(BKE_mesh_calc_normals);
 #endif
@@ -487,8 +488,9 @@ MLoopNorSpace *BKE_lnor_space_create(MLoopNorSpaceArray *lnors_spacearr)
  * Beware, this modifies ref_vec and other_vec in place!
  * In case no valid space can be generated, ref_alpha and ref_beta are set to zero (which means 'use auto lnors').
  */
-void BKE_lnor_space_define(MLoopNorSpace *lnor_space, const float lnor[3],
-                           float vec_ref[3], float vec_other[3], BLI_Stack *edge_vectors)
+void BKE_lnor_space_define(
+        MLoopNorSpace *lnor_space, const float lnor[3],
+        float vec_ref[3], float vec_other[3], BLI_Stack *edge_vectors)
 {
        const float pi2 = (float)M_PI * 2.0f;
        float tvec[3], dtp;
@@ -770,8 +772,9 @@ static void mesh_edges_sharp_tag(
                                e2l[1] = (mp->flag & ME_SMOOTH) ? INDEX_UNSET : INDEX_INVALID;
                        }
                        else if (e2l[1] == INDEX_UNSET) {
-                               const bool is_angle_sharp = (check_angle &&
-                                                            dot_v3v3(polynors[loop_to_poly[e2l[0]]], polynors[mp_index]) < split_angle_cos);
+                               const bool is_angle_sharp = (
+                                       check_angle &&
+                                       dot_v3v3(polynors[loop_to_poly[e2l[0]]], polynors[mp_index]) < split_angle_cos);
 
                                /* Second loop using this edge, time to test its sharpness.
                                 * An edge is sharp if it is tagged as such, or its face is not smooth,
@@ -1104,8 +1107,8 @@ static void split_loop_nor_fan_do(LoopSplitTaskDataCommon *common_data, LoopSpli
 
                /* Find next loop of the smooth fan. */
                BKE_mesh_loop_manifold_fan_around_vert_next(
-                           mloops, mpolys, loop_to_poly, e2lfan_curr, mv_pivot_index,
-                           &mlfan_curr, &mlfan_curr_index, &mlfan_vert_index, &mpfan_curr_index);
+                       mloops, mpolys, loop_to_poly, e2lfan_curr, mv_pivot_index,
+                       &mlfan_curr, &mlfan_curr_index, &mlfan_vert_index, &mpfan_curr_index);
 
                e2lfan_curr = edge_to_loops[mlfan_curr->e];
        }
@@ -1241,8 +1244,8 @@ static bool loop_split_generator_check_cyclic_smooth_fan(
        while (true) {
                /* Find next loop of the smooth fan. */
                BKE_mesh_loop_manifold_fan_around_vert_next(
-                           mloops, mpolys, loop_to_poly, e2lfan_curr, mv_pivot_index,
-                           &mlfan_curr, &mlfan_curr_index, &mlfan_vert_index, &mpfan_curr_index);
+                       mloops, mpolys, loop_to_poly, e2lfan_curr, mv_pivot_index,
+                       &mlfan_curr, &mlfan_curr_index, &mlfan_vert_index, &mpfan_curr_index);
 
                e2lfan_curr = edge_to_loops[mlfan_curr->e];
 
@@ -1591,9 +1594,10 @@ static void mesh_normals_loop_custom_set(
        BLI_SMALLSTACK_DECLARE(clnors_data, short *);
 
        /* Compute current lnor spacearr. */
-       BKE_mesh_normals_loop_split(mverts, numVerts, medges, numEdges, mloops, lnors, numLoops,
-                                   mpolys, polynors, numPolys, use_split_normals, split_angle,
-                                   &lnors_spacearr, NULL, loop_to_poly);
+       BKE_mesh_normals_loop_split(
+               mverts, numVerts, medges, numEdges, mloops, lnors, numLoops,
+               mpolys, polynors, numPolys, use_split_normals, split_angle,
+               &lnors_spacearr, NULL, loop_to_poly);
 
        /* Set all given zero vectors to their default value. */
        if (use_vertices) {
@@ -1701,9 +1705,10 @@ static void mesh_normals_loop_custom_set(
 
                /* And now, recompute our new auto lnors and lnor spacearr! */
                BKE_lnor_spacearr_clear(&lnors_spacearr);
-               BKE_mesh_normals_loop_split(mverts, numVerts, medges, numEdges, mloops, lnors, numLoops,
-                                           mpolys, polynors, numPolys, use_split_normals, split_angle,
-                                           &lnors_spacearr, NULL, loop_to_poly);
+               BKE_mesh_normals_loop_split(
+                       mverts, numVerts, medges, numEdges, mloops, lnors, numLoops,
+                       mpolys, polynors, numPolys, use_split_normals, split_angle,
+                       &lnors_spacearr, NULL, loop_to_poly);
        }
        else {
                BLI_BITMAP_SET_ALL(done_loops, true, (size_t)numLoops);
@@ -1775,8 +1780,9 @@ void BKE_mesh_normals_loop_custom_set(
         MPoly *mpolys, const float (*polynors)[3], const int numPolys,
         short (*r_clnors_data)[2])
 {
-       mesh_normals_loop_custom_set(mverts, numVerts, medges, numEdges, mloops, r_custom_loopnors, numLoops,
-                                    mpolys, polynors, numPolys, r_clnors_data, false);
+       mesh_normals_loop_custom_set(
+               mverts, numVerts, medges, numEdges, mloops, r_custom_loopnors, numLoops,
+               mpolys, polynors, numPolys, r_clnors_data, false);
 }
 
 void BKE_mesh_normals_loop_custom_from_vertices_set(
@@ -1785,8 +1791,9 @@ void BKE_mesh_normals_loop_custom_from_vertices_set(
         MPoly *mpolys, const float (*polynors)[3], const int numPolys,
         short (*r_clnors_data)[2])
 {
-       mesh_normals_loop_custom_set(mverts, numVerts, medges, numEdges, mloops, r_custom_vertnors, numLoops,
-                                    mpolys, polynors, numPolys, r_clnors_data, true);
+       mesh_normals_loop_custom_set(
+               mverts, numVerts, medges, numEdges, mloops, r_custom_vertnors, numLoops,
+               mpolys, polynors, numPolys, r_clnors_data, true);
 }
 
 /**
@@ -1864,8 +1871,9 @@ static void get_position(const SMikkTSpaceContext *pContext, float r_co[3], cons
        copy_v3_v3(r_co, p_mesh->mverts[p_mesh->mloops[loop_idx].v].co);
 }
 
-static void get_texture_coordinate(const SMikkTSpaceContext *pContext, float r_uv[2], const int face_idx,
-                                   const int vert_idx)
+static void get_texture_coordinate(
+        const SMikkTSpaceContext *pContext, float r_uv[2], const int face_idx,
+        const int vert_idx)
 {
        BKEMeshToTangent *p_mesh = (BKEMeshToTangent *)pContext->m_pUserData;
        copy_v2_v2(r_uv, p_mesh->luvs[p_mesh->mpolys[face_idx].loopstart + vert_idx].uv);
@@ -1877,8 +1885,9 @@ static void get_normal(const SMikkTSpaceContext *pContext, float r_no[3], const
        copy_v3_v3(r_no, p_mesh->lnors[p_mesh->mpolys[face_idx].loopstart + vert_idx]);
 }
 
-static void set_tspace(const SMikkTSpaceContext *pContext, const float fv_tangent[3], const float face_sign,
-                       const int face_idx, const int vert_idx)
+static void set_tspace(
+        const SMikkTSpaceContext *pContext, const float fv_tangent[3], const float face_sign,
+        const int face_idx, const int vert_idx)
 {
        BKEMeshToTangent *p_mesh = (BKEMeshToTangent *)pContext->m_pUserData;
        float *p_res = p_mesh->tangents[p_mesh->mpolys[face_idx].loopstart + vert_idx];
@@ -1965,8 +1974,9 @@ void BKE_mesh_loop_tangents(Mesh *mesh, const char *uvmap, float (*r_looptangent
                return;
        }
 
-       BKE_mesh_loop_tangents_ex(mesh->mvert, mesh->totvert, mesh->mloop, r_looptangents,
-                                 loopnors, loopuvs, mesh->totloop, mesh->mpoly, mesh->totpoly, reports);
+       BKE_mesh_loop_tangents_ex(
+               mesh->mvert, mesh->totvert, mesh->mloop, r_looptangents,
+               loopnors, loopuvs, mesh->totloop, mesh->mpoly, mesh->totpoly, reports);
 }
 
 /** \} */
@@ -2016,19 +2026,19 @@ void BKE_mesh_calc_poly_normal(
                mesh_calc_ngon_normal(mpoly, loopstart, mvarray, r_no);
        }
        else if (mpoly->totloop == 3) {
-               normal_tri_v3(r_no,
-                             mvarray[loopstart[0].v].co,
-                             mvarray[loopstart[1].v].co,
-                             mvarray[loopstart[2].v].co
-                             );
+               normal_tri_v3(
+                       r_no,
+                       mvarray[loopstart[0].v].co,
+                       mvarray[loopstart[1].v].co,
+                       mvarray[loopstart[2].v].co);
        }
        else if (mpoly->totloop == 4) {
-               normal_quad_v3(r_no,
-                              mvarray[loopstart[0].v].co,
-                              mvarray[loopstart[1].v].co,
-                              mvarray[loopstart[2].v].co,
-                              mvarray[loopstart[3].v].co
-                              );
+               normal_quad_v3(
+                       r_no,
+                       mvarray[loopstart[0].v].co,
+                       mvarray[loopstart[1].v].co,
+                       mvarray[loopstart[2].v].co,
+                       mvarray[loopstart[3].v].co);
        }
        else { /* horrible, two sided face! */
                r_no[0] = 0.0;
@@ -2068,19 +2078,19 @@ void BKE_mesh_calc_poly_normal_coords(
                mesh_calc_ngon_normal_coords(mpoly, loopstart, vertex_coords, r_no);
        }
        else if (mpoly->totloop == 3) {
-               normal_tri_v3(r_no,
-                             vertex_coords[loopstart[0].v],
-                             vertex_coords[loopstart[1].v],
-                             vertex_coords[loopstart[2].v]
-                             );
+               normal_tri_v3(
+                       r_no,
+                       vertex_coords[loopstart[0].v],
+                       vertex_coords[loopstart[1].v],
+                       vertex_coords[loopstart[2].v]);
        }
        else if (mpoly->totloop == 4) {
-               normal_quad_v3(r_no,
-                              vertex_coords[loopstart[0].v],
-                              vertex_coords[loopstart[1].v],
-                              vertex_coords[loopstart[2].v],
-                              vertex_coords[loopstart[3].v]
-                              );
+               normal_quad_v3(
+                       r_no,
+                       vertex_coords[loopstart[0].v],
+                       vertex_coords[loopstart[1].v],
+                       vertex_coords[loopstart[2].v],
+                       vertex_coords[loopstart[3].v]);
        }
        else { /* horrible, two sided face! */
                r_no[0] = 0.0;
@@ -2108,19 +2118,19 @@ void BKE_mesh_calc_poly_center(
         const MVert *mvarray, float r_cent[3])
 {
        if (mpoly->totloop == 3) {
-               mid_v3_v3v3v3(r_cent,
-                             mvarray[loopstart[0].v].co,
-                             mvarray[loopstart[1].v].co,
-                             mvarray[loopstart[2].v].co
-                             );
+               mid_v3_v3v3v3(
+                       r_cent,
+                       mvarray[loopstart[0].v].co,
+                       mvarray[loopstart[1].v].co,
+                       mvarray[loopstart[2].v].co);
        }
        else if (mpoly->totloop == 4) {
-               mid_v3_v3v3v3v3(r_cent,
-                               mvarray[loopstart[0].v].co,
-                               mvarray[loopstart[1].v].co,
-                               mvarray[loopstart[2].v].co,
-                               mvarray[loopstart[3].v].co
-                               );
+               mid_v3_v3v3v3v3(
+                       r_cent,
+                       mvarray[loopstart[0].v].co,
+                       mvarray[loopstart[1].v].co,
+                       mvarray[loopstart[2].v].co,
+                       mvarray[loopstart[3].v].co);
        }
        else {
                mesh_calc_ngon_center(mpoly, loopstart, mvarray, r_cent);
@@ -2133,10 +2143,10 @@ float BKE_mesh_calc_poly_area(
         const MVert *mvarray)
 {
        if (mpoly->totloop == 3) {
-               return area_tri_v3(mvarray[loopstart[0].v].co,
-                                  mvarray[loopstart[1].v].co,
-                                  mvarray[loopstart[2].v].co
-                                  );
+               return area_tri_v3(
+                       mvarray[loopstart[0].v].co,
+                       mvarray[loopstart[1].v].co,
+                       mvarray[loopstart[2].v].co);
        }
        else {
                int i;
@@ -2247,8 +2257,9 @@ static float mesh_calc_poly_area_centroid(
 }
 
 #if 0 /* slow version of the function below */
-void BKE_mesh_calc_poly_angles(MPoly *mpoly, MLoop *loopstart,
-                               MVert *mvarray, float angles[])
+void BKE_mesh_calc_poly_angles(
+        MPoly *mpoly, MLoop *loopstart,
+        MVert *mvarray, float angles[])
 {
        MLoop *ml;
        MLoop *mloop = &loopstart[-mpoly->loopstart];
@@ -2620,8 +2631,9 @@ void BKE_mesh_loops_to_mface_corners(
  *
  * \note when mface is not NULL, mface[face_index].v4 is used to test quads, else, loopindices[face_index][3] is used.
  */
-void BKE_mesh_loops_to_tessdata(CustomData *fdata, CustomData *ldata, CustomData *pdata, MFace *mface,
-                                int *polyindices, unsigned int (*loopindices)[4], const int num_faces)
+void BKE_mesh_loops_to_tessdata(
+        CustomData *fdata, CustomData *ldata, CustomData *pdata, MFace *mface,
+        int *polyindices, unsigned int (*loopindices)[4], const int num_faces)
 {
        /* Note: performances are sub-optimal when we get a NULL mface, we could be ~25% quicker with dedicated code...
         *       Issue is, unless having two different functions with nearly the same code, there's not much ways to solve
@@ -3221,8 +3233,9 @@ static void bm_corners_to_loops_ex(
 
                if (CustomData_external_test(fdata, CD_MDISPS)) {
                        if (id && fdata->external) {
-                               CustomData_external_add(ldata, id, CD_MDISPS,
-                                                       totloop, fdata->external->filename);
+                               CustomData_external_add(
+                                       ldata, id, CD_MDISPS,
+                                       totloop, fdata->external->filename);
                        }
                }
 
@@ -3260,10 +3273,11 @@ static void bm_corners_to_loops_ex(
 
 void BKE_mesh_convert_mfaces_to_mpolys(Mesh *mesh)
 {
-       BKE_mesh_convert_mfaces_to_mpolys_ex(&mesh->id, &mesh->fdata, &mesh->ldata, &mesh->pdata,
-                                            mesh->totedge, mesh->totface, mesh->totloop, mesh->totpoly,
-                                            mesh->medge, mesh->mface,
-                                            &mesh->totloop, &mesh->totpoly, &mesh->mloop, &mesh->mpoly);
+       BKE_mesh_convert_mfaces_to_mpolys_ex(
+               &mesh->id, &mesh->fdata, &mesh->ldata, &mesh->pdata,
+               mesh->totedge, mesh->totface, mesh->totloop, mesh->totpoly,
+               mesh->medge, mesh->mface,
+               &mesh->totloop, &mesh->totpoly, &mesh->mloop, &mesh->mpoly);
 
        BKE_mesh_update_customdata_pointers(mesh, true);
 }
@@ -3280,21 +3294,23 @@ void BKE_mesh_convert_mfaces_to_mpolys(Mesh *mesh)
  */
 void BKE_mesh_do_versions_convert_mfaces_to_mpolys(Mesh *mesh)
 {
-       BKE_mesh_convert_mfaces_to_mpolys_ex(&mesh->id, &mesh->fdata, &mesh->ldata, &mesh->pdata,
-                                            mesh->totedge, mesh->totface, mesh->totloop, mesh->totpoly,
-                                            mesh->medge, mesh->mface,
-                                            &mesh->totloop, &mesh->totpoly, &mesh->mloop, &mesh->mpoly);
+       BKE_mesh_convert_mfaces_to_mpolys_ex(
+               &mesh->id, &mesh->fdata, &mesh->ldata, &mesh->pdata,
+               mesh->totedge, mesh->totface, mesh->totloop, mesh->totpoly,
+               mesh->medge, mesh->mface,
+               &mesh->totloop, &mesh->totpoly, &mesh->mloop, &mesh->mpoly);
 
        CustomData_bmesh_do_versions_update_active_layers(&mesh->fdata, &mesh->pdata, &mesh->ldata);
 
        BKE_mesh_update_customdata_pointers(mesh, true);
 }
 
-void BKE_mesh_convert_mfaces_to_mpolys_ex(ID *id, CustomData *fdata, CustomData *ldata, CustomData *pdata,
-                                          int totedge_i, int totface_i, int totloop_i, int totpoly_i,
-                                          MEdge *medge, MFace *mface,
-                                          int *r_totloop, int *r_totpoly,
-                                          MLoop **r_mloop, MPoly **r_mpoly)
+void BKE_mesh_convert_mfaces_to_mpolys_ex(
+        ID *id, CustomData *fdata, CustomData *ldata, CustomData *pdata,
+        int totedge_i, int totface_i, int totloop_i, int totpoly_i,
+        MEdge *medge, MFace *mface,
+        int *r_totloop, int *r_totpoly,
+        MLoop **r_mloop, MPoly **r_mpoly)
 {
        MFace *mf;
        MLoop *ml, *mloop;
@@ -3518,10 +3534,11 @@ void BKE_mesh_polygons_flip(
 
 /* update the hide flag for edges and faces from the corresponding
  * flag in verts */
-void BKE_mesh_flush_hidden_from_verts_ex(const MVert *mvert,
-                                         const MLoop *mloop,
-                                         MEdge *medge, const int totedge,
-                                         MPoly *mpoly, const int totpoly)
+void BKE_mesh_flush_hidden_from_verts_ex(
+        const MVert *mvert,
+        const MLoop *mloop,
+        MEdge *medge, const int totedge,
+        MPoly *mpoly, const int totpoly)
 {
        int i, j;
 
@@ -3547,15 +3564,17 @@ void BKE_mesh_flush_hidden_from_verts_ex(const MVert *mvert,
 }
 void BKE_mesh_flush_hidden_from_verts(Mesh *me)
 {
-       BKE_mesh_flush_hidden_from_verts_ex(me->mvert, me->mloop,
-                                           me->medge, me->totedge,
-                                           me->mpoly, me->totpoly);
+       BKE_mesh_flush_hidden_from_verts_ex(
+               me->mvert, me->mloop,
+               me->medge, me->totedge,
+               me->mpoly, me->totpoly);
 }
 
-void BKE_mesh_flush_hidden_from_polys_ex(MVert *mvert,
-                                         const MLoop *mloop,
-                                         MEdge *medge, const int UNUSED(totedge),
-                                         const MPoly *mpoly, const int totpoly)
+void BKE_mesh_flush_hidden_from_polys_ex(
+        MVert *mvert,
+        const MLoop *mloop,
+        MEdge *medge, const int UNUSED(totedge),
+        const MPoly *mpoly, const int totpoly)
 {
        const MPoly *mp;
        int i;
@@ -3588,18 +3607,20 @@ void BKE_mesh_flush_hidden_from_polys_ex(MVert *mvert,
 }
 void BKE_mesh_flush_hidden_from_polys(Mesh *me)
 {
-       BKE_mesh_flush_hidden_from_polys_ex(me->mvert, me->mloop,
-                                           me->medge, me->totedge,
-                                           me->mpoly, me->totpoly);
+       BKE_mesh_flush_hidden_from_polys_ex(
+               me->mvert, me->mloop,
+               me->medge, me->totedge,
+               me->mpoly, me->totpoly);
 }
 
 /**
  * simple poly -> vert/edge selection.
  */
-void BKE_mesh_flush_select_from_polys_ex(MVert *mvert,       const int totvert,
-                                         const MLoop *mloop,
-                                         MEdge *medge,       const int totedge,
-                                         const MPoly *mpoly, const int totpoly)
+void BKE_mesh_flush_select_from_polys_ex(
+        MVert *mvert,       const int totvert,
+        const MLoop *mloop,
+        MEdge *medge,       const int totedge,
+        const MPoly *mpoly, const int totpoly)
 {
        MVert *mv;
        MEdge *med;
@@ -3633,16 +3654,18 @@ void BKE_mesh_flush_select_from_polys_ex(MVert *mvert,       const int totvert,
 }
 void BKE_mesh_flush_select_from_polys(Mesh *me)
 {
-       BKE_mesh_flush_select_from_polys_ex(me->mvert, me->totvert,
-                                        me->mloop,
-                                        me->medge, me->totedge,
-                                        me->mpoly, me->totpoly);
+       BKE_mesh_flush_select_from_polys_ex(
+               me->mvert, me->totvert,
+               me->mloop,
+               me->medge, me->totedge,
+               me->mpoly, me->totpoly);
 }
 
-void BKE_mesh_flush_select_from_verts_ex(const MVert *mvert, const int UNUSED(totvert),
-                                         const MLoop *mloop,
-                                         MEdge *medge,       const int totedge,
-                                         MPoly *mpoly,       const int totpoly)
+void BKE_mesh_flush_select_from_verts_ex(
+        const MVert *mvert, const int UNUSED(totvert),
+        const MLoop *mloop,
+        MEdge *medge,       const int totedge,
+        MPoly *mpoly,       const int totpoly)
 {
        MEdge *med;
        MPoly *mp;
@@ -3687,10 +3710,11 @@ void BKE_mesh_flush_select_from_verts_ex(const MVert *mvert, const int UNUSED(to
 }
 void BKE_mesh_flush_select_from_verts(Mesh *me)
 {
-       BKE_mesh_flush_select_from_verts_ex(me->mvert, me->totvert,
-                                           me->mloop,
-                                           me->medge, me->totedge,
-                                           me->mpoly, me->totpoly);
+       BKE_mesh_flush_select_from_verts_ex(
+               me->mvert, me->totvert,
+               me->mloop,
+               me->medge, me->totedge,
+               me->mpoly, me->totpoly);
 }
 /** \} */
 
@@ -3718,7 +3742,7 @@ void BKE_mesh_calc_relative_deform(
         const float (*vert_cos_dst)[3],
 
         const float (*vert_cos_org)[3],
-              float (*vert_cos_new)[3])
+        float       (*vert_cos_new)[3])
 {
        const MPoly *mp;
        int i;
index 0143125490e2615b0f357a58731555fef7a9d6ec..699d6bce2b08cccb501367255195437be24552c4 100644 (file)
@@ -243,9 +243,10 @@ static void mesh_vert_poly_or_loop_map_create(
  * Generates a map where the key is the vertex and the value is a list of polys that use that vertex as a corner.
  * The lists are allocated from one memory pool.
  */
-void BKE_mesh_vert_poly_map_create(MeshElemMap **r_map, int **r_mem,
-                                   const MPoly *mpoly, const MLoop *mloop,
-                                   int totvert, int totpoly, int totloop)
+void BKE_mesh_vert_poly_map_create(
+        MeshElemMap **r_map, int **r_mem,
+        const MPoly *mpoly, const MLoop *mloop,
+        int totvert, int totpoly, int totloop)
 {
        mesh_vert_poly_or_loop_map_create(r_map, r_mem, mpoly, mloop, totvert, totpoly, totloop, false);
 }
@@ -254,9 +255,10 @@ void BKE_mesh_vert_poly_map_create(MeshElemMap **r_map, int **r_mem,
  * Generates a map where the key is the vertex and the value is a list of loops that use that vertex as a corner.
  * The lists are allocated from one memory pool.
  */
-void BKE_mesh_vert_loop_map_create(MeshElemMap **r_map, int **r_mem,
-                                   const MPoly *mpoly, const MLoop *mloop,
-                                   int totvert, int totpoly, int totloop)
+void BKE_mesh_vert_loop_map_create(
+        MeshElemMap **r_map, int **r_mem,
+        const MPoly *mpoly, const MLoop *mloop,
+        int totvert, int totpoly, int totloop)
 {
        mesh_vert_poly_or_loop_map_create(r_map, r_mem, mpoly, mloop, totvert, totpoly, totloop, true);
 }
@@ -310,8 +312,9 @@ void BKE_mesh_vert_looptri_map_create(
  * Generates a map where the key is the vertex and the value is a list of edges that use that vertex as an endpoint.
  * The lists are allocated from one memory pool.
  */
-void BKE_mesh_vert_edge_map_create(MeshElemMap **r_map, int **r_mem,
-                                   const MEdge *medge, int totvert, int totedge)
+void BKE_mesh_vert_edge_map_create(
+        MeshElemMap **r_map, int **r_mem,
+        const MEdge *medge, int totvert, int totedge)
 {
        MeshElemMap *map = MEM_callocN(sizeof(MeshElemMap) * (size_t)totvert, "vert-edge map");
        int *indices = MEM_mallocN(sizeof(int[2]) * (size_t)totedge, "vert-edge map mem");
@@ -397,10 +400,11 @@ void BKE_mesh_vert_edge_vert_map_create(
  * Loops indices of a same poly are contiguous and in winding order.
  * The lists are allocated from one memory pool.
  */
-void BKE_mesh_edge_loop_map_create(MeshElemMap **r_map, int **r_mem,
-                                   const MEdge *UNUSED(medge), const int totedge,
-                                   const MPoly *mpoly, const int totpoly,
-                                   const MLoop *mloop, const int totloop)
+void BKE_mesh_edge_loop_map_create(
+        MeshElemMap **r_map, int **r_mem,
+        const MEdge *UNUSED(medge), const int totedge,
+        const MPoly *mpoly, const int totpoly,
+        const MLoop *mloop, const int totloop)
 {
        MeshElemMap *map = MEM_callocN(sizeof(MeshElemMap) * (size_t)totedge, "edge-poly map");
        int *indices = MEM_mallocN(sizeof(int) * (size_t)totloop * 2, "edge-poly map mem");
@@ -450,10 +454,11 @@ void BKE_mesh_edge_loop_map_create(MeshElemMap **r_map, int **r_mem,
  * Generates a map where the key is the edge and the value is a list of polygons that use that edge.
  * The lists are allocated from one memory pool.
  */
-void BKE_mesh_edge_poly_map_create(MeshElemMap **r_map, int **r_mem,
-                                   const MEdge *UNUSED(medge), const int totedge,
-                                   const MPoly *mpoly, const int totpoly,
-                                   const MLoop *mloop, const int totloop)
+void BKE_mesh_edge_poly_map_create(
+        MeshElemMap **r_map, int **r_mem,
+        const MEdge *UNUSED(medge), const int totedge,
+        const MPoly *mpoly, const int totpoly,
+        const MLoop *mloop, const int totloop)
 {
        MeshElemMap *map = MEM_callocN(sizeof(MeshElemMap) * (size_t)totedge, "edge-poly map");
        int *indices = MEM_mallocN(sizeof(int) * (size_t)totloop, "edge-poly map mem");
@@ -509,9 +514,10 @@ void BKE_mesh_edge_poly_map_create(MeshElemMap **r_map, int **r_mem,
  *       ``totfinal`` could be ``tottessface`` and ``final_origindex`` its ORIGINDEX customdata.
  *       This would allow an MPoly to loop over its tessfaces.
  */
-void BKE_mesh_origindex_map_create(MeshElemMap **r_map, int **r_mem,
-                                   const int totsource,
-                                   const int *final_origindex, const int totfinal)
+void BKE_mesh_origindex_map_create(
+        MeshElemMap **r_map, int **r_mem,
+        const int totsource,
+        const int *final_origindex, const int totfinal)
 {
        MeshElemMap *map = MEM_callocN(sizeof(MeshElemMap) * (size_t)totsource, "poly-tessface map");
        int *indices = MEM_mallocN(sizeof(int) * (size_t)totfinal, "poly-tessface map mem");
@@ -632,8 +638,9 @@ static void poly_edge_loop_islands_calc(
        }
 
        if (!edge_poly_map) {
-               BKE_mesh_edge_poly_map_create(&edge_poly_map, &edge_poly_mem,
-                                             medge, totedge, mpoly, totpoly, mloop, totloop);
+               BKE_mesh_edge_poly_map_create(
+                       &edge_poly_map, &edge_poly_mem,
+                       medge, totedge, mpoly, totpoly, mloop, totloop);
        }
 
        poly_groups = MEM_callocN(sizeof(int) * (size_t)totpoly, __func__);
@@ -786,10 +793,11 @@ static bool poly_is_island_boundary_smooth_cb(
  *         (0 being used as 'invalid' flag).
  *         Note it's callers's responsibility to MEM_freeN returned array.
  */
-int *BKE_mesh_calc_smoothgroups(const MEdge *medge, const int totedge,
-                                const MPoly *mpoly, const int totpoly,
-                                const MLoop *mloop, const int totloop,
-                                int *r_totgroup, const bool use_bitflags)
+int *BKE_mesh_calc_smoothgroups(
+        const MEdge *medge, const int totedge,
+        const MPoly *mpoly, const int totpoly,
+        const MLoop *mloop, const int totloop,
+        int *r_totgroup, const bool use_bitflags)
 {
        int *poly_groups = NULL;
 
@@ -987,21 +995,23 @@ static bool mesh_calc_islands_loop_poly_uv(
        BKE_mesh_loop_islands_clear(r_island_store);
        BKE_mesh_loop_islands_init(r_island_store, MISLAND_TYPE_LOOP, totloop, MISLAND_TYPE_POLY, MISLAND_TYPE_EDGE);
 
-       BKE_mesh_edge_poly_map_create(&edge_poly_map, &edge_poly_mem,
-                                     edges, totedge, polys, totpoly, loops, totloop);
+       BKE_mesh_edge_poly_map_create(
+               &edge_poly_map, &edge_poly_mem,
+               edges, totedge, polys, totpoly, loops, totloop);
 
        if (luvs) {
-               BKE_mesh_edge_loop_map_create(&edge_loop_map, &edge_loop_mem,
-                                             edges, totedge, polys, totpoly, loops, totloop);
+               BKE_mesh_edge_loop_map_create(
+                       &edge_loop_map, &edge_loop_mem,
+                       edges, totedge, polys, totpoly, loops, totloop);
                edge_boundary_check_data.loops = loops;
                edge_boundary_check_data.luvs = luvs;
                edge_boundary_check_data.edge_loop_map = edge_loop_map;
        }
 
        poly_edge_loop_islands_calc(
-                   edges, totedge, polys, totpoly, loops, totloop, edge_poly_map, false,
-                   mesh_check_island_boundary_uv, luvs ? &edge_boundary_check_data : NULL,
-                   &poly_groups, &num_poly_groups, &edge_borders, &num_edge_borders);
+               edges, totedge, polys, totpoly, loops, totloop, edge_poly_map, false,
+               mesh_check_island_boundary_uv, luvs ? &edge_boundary_check_data : NULL,
+               &poly_groups, &num_poly_groups, &edge_borders, &num_edge_borders);
 
        if (!num_poly_groups) {
                /* Should never happen... */
@@ -1051,8 +1061,9 @@ static bool mesh_calc_islands_loop_poly_uv(
                        }
                }
 
-               BKE_mesh_loop_islands_add(r_island_store, num_lidx, loop_indices, num_pidx, poly_indices,
-                                         num_einnercuts, edge_innercut_indices);
+               BKE_mesh_loop_islands_add(
+                       r_island_store, num_lidx, loop_indices, num_pidx, poly_indices,
+                       num_einnercuts, edge_innercut_indices);
        }
 
        MEM_freeN(edge_poly_map);
@@ -1089,7 +1100,7 @@ bool BKE_mesh_calc_islands_loop_poly_edgeseam(
         MeshIslandStore *r_island_store)
 {
        return mesh_calc_islands_loop_poly_uv(
-                   verts, totvert, edges, totedge, polys, totpoly, loops, totloop, NULL, r_island_store);
+               verts, totvert, edges, totedge, polys, totpoly, loops, totloop, NULL, r_island_store);
 }
 
 /**
@@ -1113,7 +1124,7 @@ bool BKE_mesh_calc_islands_loop_poly_uvmap(
 {
        BLI_assert(luvs != NULL);
        return mesh_calc_islands_loop_poly_uv(
-                   verts, totvert, edges, totedge, polys, totpoly, loops, totloop, luvs, r_island_store);
+               verts, totvert, edges, totedge, polys, totpoly, loops, totloop, luvs, r_island_store);
 }
 
 /** \} */
index eef8657482f6dab240b1cc23344b640d0ad0db55..77aefc04f5ff17b82687314debd69c3713601cec 100644 (file)
@@ -669,8 +669,9 @@ void BKE_mesh_remap_calc_edges_from_dm(
                                v_dst_to_src_map[i].hit_dist = -1.0f;
                        }
 
-                       BKE_mesh_vert_edge_map_create(&vert_to_edge_src_map, &vert_to_edge_src_map_mem,
-                                                     edges_src, num_verts_src, num_edges_src);
+                       BKE_mesh_vert_edge_map_create(
+                               &vert_to_edge_src_map, &vert_to_edge_src_map_mem,
+                               edges_src, num_verts_src, num_edges_src);
 
                        dm_src->getVertCos(dm_src, vcos_src);
 
@@ -932,8 +933,9 @@ void BKE_mesh_remap_calc_edges_from_dm(
                                                indices[sources_num] = j;
                                                sources_num++;
                                        }
-                                       mesh_remap_item_define(r_map, i, hit_dist_accum / totweights, 0,
-                                                                         sources_num, indices, weights);
+                                       mesh_remap_item_define(
+                                               r_map, i, hit_dist_accum / totweights, 0,
+                                               sources_num, indices, weights);
                                }
                                else {
                                        /* No source for this dest edge! */
@@ -1147,8 +1149,9 @@ void BKE_mesh_remap_calc_loops_from_dm(
 
                BLI_AStarGraph *as_graphdata = NULL;
                BLI_AStarSolution as_solution = {0};
-               const int isld_steps_src = islands_precision_src ?
-                                          max_ii((int)(ASTAR_STEPS_MAX * islands_precision_src + 0.499f), 1) : 0;
+               const int isld_steps_src = (
+                       islands_precision_src ?
+                       max_ii((int)(ASTAR_STEPS_MAX * islands_precision_src + 0.499f), 1) : 0);
 
                float (*poly_nors_src)[3] = NULL;
                float (*loop_nors_src)[3] = NULL;
@@ -1220,8 +1223,9 @@ void BKE_mesh_remap_calc_loops_from_dm(
                                        CustomData_set_layer_flag(pdata_dst, CD_NORMAL, CD_FLAG_TEMPORARY);
                                }
                                if (dirty_nors_dst) {
-                                       BKE_mesh_calc_normals_poly(verts_dst, NULL, numverts_dst, loops_dst, polys_dst,
-                                                                  numloops_dst, numpolys_dst, poly_nors_dst, true);
+                                       BKE_mesh_calc_normals_poly(
+                                               verts_dst, NULL, numverts_dst, loops_dst, polys_dst,
+                                               numloops_dst, numpolys_dst, poly_nors_dst, true);
                                }
                        }
                        if (need_lnors_dst) {
@@ -1234,10 +1238,11 @@ void BKE_mesh_remap_calc_loops_from_dm(
                                                loop_nors_dst = CustomData_add_layer(ldata_dst, CD_NORMAL, CD_CALLOC, NULL, numloops_dst);
                                                CustomData_set_layer_flag(ldata_dst, CD_NORMAL, CD_FLAG_TEMPORARY);
                                        }
-                                       BKE_mesh_normals_loop_split(verts_dst, numverts_dst, edges_dst, numedges_dst,
-                                                                   loops_dst, loop_nors_dst, numloops_dst,
-                                                                   polys_dst, (const float (*)[3])poly_nors_dst, numpolys_dst,
-                                                                   use_split_nors_dst, split_angle_dst, NULL, custom_nors_dst, NULL);
+                                       BKE_mesh_normals_loop_split(
+                                               verts_dst, numverts_dst, edges_dst, numedges_dst,
+                                               loops_dst, loop_nors_dst, numloops_dst,
+                                               polys_dst, (const float (*)[3])poly_nors_dst, numpolys_dst,
+                                               use_split_nors_dst, split_angle_dst, NULL, custom_nors_dst, NULL);
                                }
                        }
                        if (need_pnors_src || need_lnors_src) {
@@ -1254,17 +1259,20 @@ void BKE_mesh_remap_calc_loops_from_dm(
                }
 
                if (use_from_vert) {
-                       BKE_mesh_vert_loop_map_create(&vert_to_loop_map_src, &vert_to_loop_map_src_buff,
-                                                     polys_src, loops_src, num_verts_src, num_polys_src, num_loops_src);
+                       BKE_mesh_vert_loop_map_create(
+                               &vert_to_loop_map_src, &vert_to_loop_map_src_buff,
+                               polys_src, loops_src, num_verts_src, num_polys_src, num_loops_src);
                        if (mode & MREMAP_USE_POLY) {
-                               BKE_mesh_vert_poly_map_create(&vert_to_poly_map_src, &vert_to_poly_map_src_buff,
-                                                             polys_src, loops_src, num_verts_src, num_polys_src, num_loops_src);
+                               BKE_mesh_vert_poly_map_create(
+                                       &vert_to_poly_map_src, &vert_to_poly_map_src_buff,
+                                       polys_src, loops_src, num_verts_src, num_polys_src, num_loops_src);
                        }
                }
 
                /* Needed for islands (or plain mesh) to AStar graph conversion. */
-               BKE_mesh_edge_poly_map_create(&edge_to_poly_map_src, &edge_to_poly_map_src_buff,
-                                             edges_src, num_edges_src, polys_src, num_polys_src, loops_src, num_loops_src);
+               BKE_mesh_edge_poly_map_create(
+                       &edge_to_poly_map_src, &edge_to_poly_map_src_buff,
+                       edges_src, num_edges_src, polys_src, num_polys_src, loops_src, num_loops_src);
                if (use_from_vert) {
                        loop_to_poly_map_src = MEM_mallocN(sizeof(*loop_to_poly_map_src) * (size_t)num_loops_src, __func__);
                        poly_cents_src = MEM_mallocN(sizeof(*poly_cents_src) * (size_t)num_polys_src, __func__);
@@ -1345,8 +1353,9 @@ void BKE_mesh_remap_calc_loops_from_dm(
                                                }
                                        }
                                        /* verts 'ownership' is transfered to treedata here, which will handle its freeing. */
-                                       bvhtree_from_mesh_verts_ex(&treedata[tindex], verts_src, num_verts_src, verts_allocated_src,
-                                                                  verts_active, num_verts_active, 0.0, 2, 6);
+                                       bvhtree_from_mesh_verts_ex(
+                                               &treedata[tindex], verts_src, num_verts_src, verts_allocated_src,
+                                               verts_active, num_verts_active, 0.0, 2, 6);
                                        if (verts_allocated_src) {
                                                verts_allocated_src = false;  /* Only 'give' our verts once, to first tree! */
                                        }
@@ -1481,13 +1490,15 @@ void BKE_mesh_remap_calc_loops_from_dm(
                                                                BLI_assert(index_src != -1);
                                                                const float dot = dot_v3v3(nors_src[index_src], *nor_dst);
 
-                                                               pidx_src = (mode == MREMAP_MODE_LOOP_NEAREST_LOOPNOR) ?
-                                                                              loop_to_poly_map_src[index_src] : index_src;
+                                                               pidx_src = (
+                                                                       (mode == MREMAP_MODE_LOOP_NEAREST_LOOPNOR) ?
+                                                                       loop_to_poly_map_src[index_src] : index_src);
                                                                /* WARNING! This is not the *real* lidx_src in case of POLYNOR, we only use it
                                                                 *          to check we stay on current island (all loops from a given poly are
                                                                 *          on same island!). */
-                                                               lidx_src = (mode == MREMAP_MODE_LOOP_NEAREST_LOOPNOR) ?
-                                                                              index_src : polys_src[pidx_src].loopstart;
+                                                               lidx_src = (
+                                                                       (mode == MREMAP_MODE_LOOP_NEAREST_LOOPNOR) ?
+                                                                       index_src : polys_src[pidx_src].loopstart);
 
                                                                /* A same vert may be at the boundary of several islands! Hence, we have to ensure
                                                                 * poly/loop we are currently considering *belongs* to current island! */
@@ -1506,7 +1517,7 @@ void BKE_mesh_remap_calc_loops_from_dm(
 
                                                                        if (!pcent_dst_valid) {
                                                                                BKE_mesh_calc_poly_center(
-                                                                                           mp_dst, &loops_dst[mp_dst->loopstart], verts_dst, pcent_dst);
+                                                                                       mp_dst, &loops_dst[mp_dst->loopstart], verts_dst, pcent_dst);
                                                                                pcent_dst_valid = true;
                                                                        }
                                                                        pcent_src = poly_cents_src[pidx_src];
@@ -1737,8 +1748,9 @@ void BKE_mesh_remap_calc_loops_from_dm(
                                                                                        BLI_space_transform_apply(space_transform, tmp_co);
                                                                                }
 
-                                                                               pidx_src = use_islands ? best_island->indices[last_valid_pidx_isld_src] :
-                                                                                                        last_valid_pidx_isld_src;
+                                                                               pidx_src = (
+                                                                                       use_islands ? best_island->indices[last_valid_pidx_isld_src] :
+                                                                                       last_valid_pidx_isld_src);
                                                                                mp_src = &polys_src[pidx_src];
                                                                                ml_src = &loops_src[mp_src->loopstart];
                                                                                for (j = 0; j < mp_src->totloop; j++, ml_src++) {
@@ -1822,8 +1834,9 @@ void BKE_mesh_remap_calc_loops_from_dm(
                                                                                        BLI_space_transform_apply(space_transform, tmp_co);
                                                                                }
 
-                                                                               pidx_src = use_islands ? best_island->indices[last_valid_pidx_isld_src] :
-                                                                                                        last_valid_pidx_isld_src;
+                                                                               pidx_src = (
+                                                                                       use_islands ? best_island->indices[last_valid_pidx_isld_src] :
+                                                                                       last_valid_pidx_isld_src);
                                                                                mp_src = &polys_src[pidx_src];
 
                                                                                /* Create that one on demand. */
@@ -1984,8 +1997,9 @@ void BKE_mesh_remap_calc_polys_from_dm(
                        CustomData_set_layer_flag(pdata_dst, CD_NORMAL, CD_FLAG_TEMPORARY);
                }
                if (dirty_nors_dst) {
-                       BKE_mesh_calc_normals_poly(verts_dst, NULL, numverts_dst, loops_dst, polys_dst, numloops_dst, numpolys_dst,
-                                                  poly_nors_dst, true);
+                       BKE_mesh_calc_normals_poly(
+                               verts_dst, NULL, numverts_dst, loops_dst, polys_dst, numloops_dst, numpolys_dst,
+                               poly_nors_dst, true);
                }
        }
 
@@ -2168,8 +2182,9 @@ void BKE_mesh_remap_calc_polys_from_dm(
                                        tri_vidx_2d[1][2] = 3;
                                }
                                else {
-                                       BLI_polyfill_calc(poly_vcos_2d, (unsigned int)mp->totloop, -1,
-                                                         (unsigned int (*)[3])tri_vidx_2d);
+                                       BLI_polyfill_calc(
+                                               poly_vcos_2d, (unsigned int)mp->totloop, -1,
+                                               (unsigned int (*)[3])tri_vidx_2d);
                                }
 
                                for (j = 0; j < tris_num; j++) {
index 946677e0ab2beaf18fe61fba704fbcf4a11025d1..5c835bbf0fa24576ab5ed7dce08d5e249cf7ea79 100644 (file)
@@ -212,15 +212,16 @@ static int search_polyloop_cmp(const void *v1, const void *v2)
  *
  * \return false if no changes needed to be made.
  */
-bool BKE_mesh_validate_arrays(Mesh *mesh,
-                              MVert *mverts, unsigned int totvert,
-                              MEdge *medges, unsigned int totedge,
-                              MFace *mfaces, unsigned int totface,
-                              MLoop *mloops, unsigned int totloop,
-                              MPoly *mpolys, unsigned int totpoly,
-                              MDeformVert *dverts, /* assume totvert length */
-                              const bool do_verbose, const bool do_fixes,
-                              bool *r_changed)
+bool BKE_mesh_validate_arrays(
+        Mesh *mesh,
+        MVert *mverts, unsigned int totvert,
+        MEdge *medges, unsigned int totedge,
+        MFace *mfaces, unsigned int totface,
+        MLoop *mloops, unsigned int totloop,
+        MPoly *mpolys, unsigned int totpoly,
+        MDeformVert *dverts, /* assume totvert length */
+        const bool do_verbose, const bool do_fixes,
+        bool *r_changed)
 {
 #   define REMOVE_EDGE_TAG(_me) { _me->v2 = _me->v1; free_flag.edges = do_fixes; } (void)0
 #   define IS_REMOVED_EDGE(_me) (_me->v2 == _me->v1)
@@ -875,9 +876,10 @@ bool BKE_mesh_validate_arrays(Mesh *mesh,
        return is_valid;
 }
 
-static bool mesh_validate_customdata(CustomData *data, CustomDataMask mask,
-                                     const bool do_verbose, const bool do_fixes,
-                                     bool *r_change)
+static bool mesh_validate_customdata(
+        CustomData *data, CustomDataMask mask,
+        const bool do_verbose, const bool do_fixes,
+        bool *r_change)
 {
        bool is_valid = true;
        bool has_fixes = false;
@@ -928,11 +930,12 @@ static bool mesh_validate_customdata(CustomData *data, CustomDataMask mask,
 /**
  * \returns is_valid.
  */
-bool BKE_mesh_validate_all_customdata(CustomData *vdata, CustomData *edata,
-                                      CustomData *ldata, CustomData *pdata,
-                                      const bool check_meshmask,
-                                      const bool do_verbose, const bool do_fixes,
-                                      bool *r_change)
+bool BKE_mesh_validate_all_customdata(
+        CustomData *vdata, CustomData *edata,
+        CustomData *ldata, CustomData *pdata,
+        const bool check_meshmask,
+        const bool do_verbose, const bool do_fixes,
+        bool *r_change)
 {
        bool is_valid = true;
        bool is_change_v, is_change_e, is_change_l, is_change_p;
@@ -1268,9 +1271,10 @@ struct EdgeSort {
 };
 
 /* edges have to be added with lowest index first for sorting */
-static void to_edgesort(struct EdgeSort *ed,
-                        unsigned int v1, unsigned int v2,
-                        char is_loose, short is_draw)
+static void to_edgesort(
+        struct EdgeSort *ed,
+        unsigned int v1, unsigned int v2,
+        char is_loose, short is_draw)
 {
        if (v1 < v2) {
                ed->v1 = v1; ed->v2 = v2;
@@ -1419,9 +1423,10 @@ void BKE_mesh_calc_edges_legacy(Mesh *me, const bool use_old)
        MEdge *medge;
        int totedge = 0;
 
-       mesh_calc_edges_mdata(me->mvert, me->mface, me->mloop, me->mpoly,
-                             me->totvert, me->totface, me->totloop, me->totpoly,
-                             use_old, &medge, &totedge);
+       mesh_calc_edges_mdata(
+               me->mvert, me->mface, me->mloop, me->mpoly,
+               me->totvert, me->totface, me->totloop, me->totpoly,
+               use_old, &medge, &totedge);
 
        if (totedge == 0) {
                /* flag that mesh has edges */