Blenkernel: move DerivedMesh.c to c++

Required changes to make it compile with clang tidy:
* Use c++ includes like (e.g. climits instead limits.h).
* Insert type casts when casting from void* to something else.
* Replace NULL with nullptr.
* Insert casts from int to enum.
* Replace designed initializers (not supported in C++ yet).
* Use blender::Vector instead of BLI_array_staticdeclare (does not compile with C++).
* Replace typedef statements.

Ref T83357.
This commit is contained in:
2020-12-14 13:00:28 +01:00
parent 551856ed32
commit 732d0b458b
6 changed files with 197 additions and 178 deletions

View File

@@ -678,7 +678,7 @@ void BKE_mesh_calc_edges_loose(struct Mesh *mesh);
void BKE_mesh_calc_edges(struct Mesh *mesh, bool keep_existing_edges, const bool select_new_edges); void BKE_mesh_calc_edges(struct Mesh *mesh, bool keep_existing_edges, const bool select_new_edges);
void BKE_mesh_calc_edges_tessface(struct Mesh *mesh); void BKE_mesh_calc_edges_tessface(struct Mesh *mesh);
/* In DerivedMesh.c */ /* In DerivedMesh.cc */
void BKE_mesh_wrapper_deferred_finalize(struct Mesh *me_eval, void BKE_mesh_wrapper_deferred_finalize(struct Mesh *me_eval,
const CustomData_MeshMasks *cd_mask_finalize); const CustomData_MeshMasks *cd_mask_finalize);

View File

@@ -57,9 +57,9 @@ void BKE_mesh_runtime_verttri_from_looptri(struct MVertTri *r_verttri,
const struct MLoopTri *looptri, const struct MLoopTri *looptri,
int looptri_num); int looptri_num);
/* NOTE: the functions below are defined in DerivedMesh.c, and are intended to be moved /* NOTE: the functions below are defined in DerivedMesh.cc, and are intended to be moved
* to a more suitable location when that file is removed. * to a more suitable location when that file is removed.
* They should also be renamed to use conventions from BKE, not old DerivedMesh.c. * They should also be renamed to use conventions from BKE, not old DerivedMesh.cc.
* For now keep the names similar to avoid confusion. */ * For now keep the names similar to avoid confusion. */
struct Mesh *mesh_get_eval_final(struct Depsgraph *depsgraph, struct Mesh *mesh_get_eval_final(struct Depsgraph *depsgraph,
struct Scene *scene, struct Scene *scene,

View File

@@ -66,7 +66,7 @@ set(SRC
intern/CCGSubSurf.c intern/CCGSubSurf.c
intern/CCGSubSurf_legacy.c intern/CCGSubSurf_legacy.c
intern/CCGSubSurf_util.c intern/CCGSubSurf_util.c
intern/DerivedMesh.c intern/DerivedMesh.cc
intern/action.c intern/action.c
intern/addon.c intern/addon.c
intern/anim_data.c intern/anim_data.c

View File

@@ -1460,7 +1460,7 @@ Mesh *BKE_mesh_create_derived_for_modifier(struct Depsgraph *depsgraph,
return result; return result;
} }
/* This is a Mesh-based copy of the same function in DerivedMesh.c */ /* This is a Mesh-based copy of the same function in DerivedMesh.cc */
static void shapekey_layers_to_keyblocks(Mesh *mesh_src, Mesh *mesh_dst, int actshape_uid) static void shapekey_layers_to_keyblocks(Mesh *mesh_src, Mesh *mesh_dst, int actshape_uid)
{ {
KeyBlock *kb; KeyBlock *kb;

View File

@@ -116,7 +116,7 @@ static void deformVerts(ModifierData *md,
mesh_src = (Mesh *)BKE_id_copy_ex(NULL, (ID *)mesh, NULL, LIB_ID_COPY_LOCALIZE); mesh_src = (Mesh *)BKE_id_copy_ex(NULL, (ID *)mesh, NULL, LIB_ID_COPY_LOCALIZE);
} }
/* TODO(sergey): For now it actually duplicates logic from DerivedMesh.c /* TODO(sergey): For now it actually duplicates logic from DerivedMesh.cc
* and needs some more generic solution. But starting experimenting with * and needs some more generic solution. But starting experimenting with
* this so close to the release is not that nice.. * this so close to the release is not that nice..
* *