Commit: 79053a6ff74a10ef7f51f4b7c5b0e5e5a542eb5a Author: Hans Goudey Date: Thu Jan 19 15:54:47 2023 -0600 Branches: master https://developer.blender.org/rB79053a6ff74a10ef7f51f4b7c5b0e5e5a542eb5a
Cleanup: Move several modifiers files to C++ For continued refactoring of the Mesh data structure. See T103343. =================================================================== M source/blender/modifiers/CMakeLists.txt R085 source/blender/modifiers/intern/MOD_build.c source/blender/modifiers/intern/MOD_build.cc R084 source/blender/modifiers/intern/MOD_correctivesmooth.c source/blender/modifiers/intern/MOD_correctivesmooth.cc R084 source/blender/modifiers/intern/MOD_explode.c source/blender/modifiers/intern/MOD_explode.cc R087 source/blender/modifiers/intern/MOD_laplaciansmooth.c source/blender/modifiers/intern/MOD_laplaciansmooth.cc R079 source/blender/modifiers/intern/MOD_ocean.c source/blender/modifiers/intern/MOD_ocean.cc R084 source/blender/modifiers/intern/MOD_particleinstance.c source/blender/modifiers/intern/MOD_particleinstance.cc R070 source/blender/modifiers/intern/MOD_remesh.c source/blender/modifiers/intern/MOD_remesh.cc R077 source/blender/modifiers/intern/MOD_solidify.c source/blender/modifiers/intern/MOD_solidify.cc R086 source/blender/modifiers/intern/MOD_solidify_extrude.c source/blender/modifiers/intern/MOD_solidify_extrude.cc R084 source/blender/modifiers/intern/MOD_solidify_nonmanifold.c source/blender/modifiers/intern/MOD_solidify_nonmanifold.cc R087 source/blender/modifiers/intern/MOD_solidify_util.h source/blender/modifiers/intern/MOD_solidify_util.hh R087 source/blender/modifiers/intern/MOD_surfacedeform.c source/blender/modifiers/intern/MOD_surfacedeform.cc =================================================================== diff --git a/source/blender/modifiers/CMakeLists.txt b/source/blender/modifiers/CMakeLists.txt index 30ddca5e47d..a0cf583153b 100644 --- a/source/blender/modifiers/CMakeLists.txt +++ b/source/blender/modifiers/CMakeLists.txt @@ -37,22 +37,22 @@ set(SRC intern/MOD_array.cc intern/MOD_bevel.c intern/MOD_boolean.cc - intern/MOD_build.c + intern/MOD_build.cc intern/MOD_cast.c intern/MOD_cloth.c intern/MOD_collision.c - intern/MOD_correctivesmooth.c + intern/MOD_correctivesmooth.cc intern/MOD_curve.c intern/MOD_datatransfer.cc intern/MOD_decimate.c intern/MOD_displace.cc intern/MOD_dynamicpaint.c intern/MOD_edgesplit.c - intern/MOD_explode.c + intern/MOD_explode.cc intern/MOD_fluid.c intern/MOD_hook.c intern/MOD_laplaciandeform.c - intern/MOD_laplaciansmooth.c + intern/MOD_laplaciansmooth.cc intern/MOD_lattice.c intern/MOD_mask.cc intern/MOD_mesh_to_volume.cc @@ -67,10 +67,10 @@ set(SRC intern/MOD_nodes.cc intern/MOD_none.c intern/MOD_normal_edit.cc - intern/MOD_ocean.c - intern/MOD_particleinstance.c + intern/MOD_ocean.cc + intern/MOD_particleinstance.cc intern/MOD_particlesystem.cc - intern/MOD_remesh.c + intern/MOD_remesh.cc intern/MOD_screw.cc intern/MOD_shapekey.c intern/MOD_shrinkwrap.c @@ -78,12 +78,12 @@ set(SRC intern/MOD_skin.c intern/MOD_smooth.c intern/MOD_softbody.c - intern/MOD_solidify.c - intern/MOD_solidify_extrude.c - intern/MOD_solidify_nonmanifold.c + intern/MOD_solidify.cc + intern/MOD_solidify_extrude.cc + intern/MOD_solidify_nonmanifold.cc intern/MOD_subsurf.cc intern/MOD_surface.c - intern/MOD_surfacedeform.c + intern/MOD_surfacedeform.cc intern/MOD_triangulate.cc intern/MOD_ui_common.c intern/MOD_util.cc @@ -104,7 +104,7 @@ set(SRC MOD_modifiertypes.h MOD_nodes.h intern/MOD_meshcache_util.h - intern/MOD_solidify_util.h + intern/MOD_solidify_util.hh intern/MOD_ui_common.h intern/MOD_util.h intern/MOD_weightvg_util.h diff --git a/source/blender/modifiers/intern/MOD_build.c b/source/blender/modifiers/intern/MOD_build.cc similarity index 85% rename from source/blender/modifiers/intern/MOD_build.c rename to source/blender/modifiers/intern/MOD_build.cc index b2c9995a928..ae69677a2d6 100644 --- a/source/blender/modifiers/intern/MOD_build.c +++ b/source/blender/modifiers/intern/MOD_build.cc @@ -48,18 +48,17 @@ static void initData(ModifierData *md) MEMCPY_STRUCT_AFTER(bmd, DNA_struct_default_get(BuildModifierData), modifier); } -static bool dependsOnTime(struct Scene *UNUSED(scene), ModifierData *UNUSED(md)) +static bool dependsOnTime(Scene * /*scene*/, ModifierData * /*md*/) { return true; } -static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, struct Mesh *mesh) +static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, Mesh *mesh) { Mesh *result; BuildModifierData *bmd = (BuildModifierData *)md; int i, j, k; int faces_dst_num, edges_dst_num, loops_dst_num = 0; - int *vertMap, *edgeMap, *faceMap; float frac; MPoly *mpoly_dst; MLoop *ml_dst; @@ -79,15 +78,15 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, struct const MPoly *mpoly_src = BKE_mesh_polys(mesh); const MLoop *mloop_src = BKE_mesh_loops(mesh); - vertMap = MEM_malloc_arrayN(vert_src_num, sizeof(*vertMap), "build modifier vertMap"); - edgeMap = MEM_malloc_arrayN(edge_src_num, sizeof(*edgeMap), "build modifier edgeMap"); - faceMap = MEM_malloc_arrayN(poly_src_num, sizeof(*faceMap), "build modifier faceMap"); + int *vertMap = static_cast<int *>(MEM_malloc_arrayN(vert_src_num, sizeof(int), __func__)); + int *edgeMap = static_cast<int *>(MEM_malloc_arrayN(edge_src_num, sizeof(int), __func__)); + int *faceMap = static_cast<int *>(MEM_malloc_arrayN(poly_src_num, sizeof(int), __func__)); range_vn_i(vertMap, vert_src_num, 0); range_vn_i(edgeMap, edge_src_num, 0); range_vn_i(faceMap, poly_src_num, 0); - struct Scene *scene = DEG_get_input_scene(ctx->depsgraph); + Scene *scene = DEG_get_input_scene(ctx->depsgraph); frac = (BKE_scene_ctime_get(scene) - bmd->start) / bmd->length; CLAMP(frac, 0.0f, 1.0f); if (bmd->flag & MOD_BUILD_FLAG_REVERSE) { @@ -253,9 +252,9 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, struct } } - BLI_ghash_free(vertHash, NULL, NULL); - BLI_ghash_free(edgeHash, NULL, NULL); - BLI_ghash_free(edgeHash2, NULL, NULL); + BLI_ghash_free(vertHash, nullptr, nullptr); + BLI_ghash_free(edgeHash, nullptr, nullptr); + BLI_ghash_free(edgeHash2, nullptr, nullptr); MEM_freeN(vertMap); MEM_freeN(edgeMap); @@ -265,40 +264,40 @@ static Mesh *modifyMesh(ModifierData *md, const ModifierEvalContext *ctx, struct return result; } -static void panel_draw(const bContext *UNUSED(C), Panel *panel) +static void panel_draw(const bContext * /*C*/, Panel *panel) { uiLayout *layout = panel->layout; - PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL); + PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr); uiLayoutSetPropSep(layout, true); - uiItemR(layout, ptr, "frame_start", 0, NULL, ICON_NONE); - uiItemR(layout, ptr, "frame_duration", 0, NULL, ICON_NONE); - uiItemR(layout, ptr, "use_reverse", 0, NULL, ICON_NONE); + uiItemR(layout, ptr, "frame_start", 0, nullptr, ICON_NONE); + uiItemR(layout, ptr, "frame_duration", 0, nullptr, ICON_NONE); + uiItemR(layout, ptr, "use_reverse", 0, nullptr, ICON_NONE); modifier_panel_end(layout, ptr); } -static void random_panel_header_draw(const bContext *UNUSED(C), Panel *panel) +static void random_panel_header_draw(const bContext * /*C*/, Panel *panel) { uiLayout *layout = panel->layout; - PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL); + PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr); - uiItemR(layout, ptr, "use_random_order", 0, NULL, ICON_NONE); + uiItemR(layout, ptr, "use_random_order", 0, nullptr, ICON_NONE); } -static void random_panel_draw(const bContext *UNUSED(C), Panel *panel) +static void random_panel_draw(const bContext * /*C*/, Panel *panel) { uiLayout *layout = panel->layout; - PointerRNA *ptr = modifier_panel_get_property_pointers(panel, NULL); + PointerRNA *ptr = modifier_panel_get_property_pointers(panel, nullptr); uiLayoutSetPropSep(layout, true); uiLayoutSetActive(layout, RNA_boolean_get(ptr, "use_random_order")); - uiItemR(layout, ptr, "seed", 0, NULL, ICON_NONE); + uiItemR(layout, ptr, "seed", 0, nullptr, ICON_NONE); } static void panelRegister(ARegionType *region_type) @@ -319,24 +318,24 @@ ModifierTypeInfo modifierType_Build = { /*copyData*/ BKE_modifier_copydata_generic, - /*deformVerts*/ NULL, - /*deformMatrices*/ NULL, - /*deformVertsEM*/ NULL, - /*deformMatricesEM*/ NULL, + /*deformVerts*/ nullptr, + /*deformMatrices*/ nullptr, + /*deformVertsEM*/ nullptr, + /*deformMatricesEM*/ nullptr, /*modifyMesh*/ modifyMesh, - /*modifyGeometrySet*/ NULL, + /*modifyGeometrySet*/ nullptr, /*initData*/ initData, - /*requiredDataMask*/ NULL, - /*freeData*/ NULL, - /*isDisabled*/ NULL, - /*updateDepsgraph*/ NULL, + /*requiredDataMask*/ nullptr, + /*freeData*/ nullptr, + /*isDisabled*/ nullptr, + /*updateDepsgraph*/ nullptr, /*dependsOnTime*/ dependsOnTime, - /*dependsOnNormals*/ NULL, - /*foreachIDLink*/ NULL, - /*foreachTexLink*/ NULL, - /*freeRuntimeData*/ NULL, + /*dependsOnNormals*/ nullptr, + /*foreachIDLink*/ nullptr, + /*foreachTexLink*/ nullptr, + /*freeRuntimeData*/ nullptr, /*panelRegister*/ panelRegister, - /*blendWrite*/ NULL, - /*blendRead*/ NULL, + /*blendWrite*/ nullptr, + /*blendRead*/ nullptr, }; diff --git a/source/blender/modifiers/intern/MOD_correctivesmooth.c b/source/blender/modifiers/intern/MOD_correctivesmooth.cc similarity index 84% rename from source/blender/modifiers/intern/MOD_correctivesmooth.c rename to source/blender/modifiers/intern/MOD_correctivesmooth.cc index 50b6c7fcb32..83b51187c6b 100644 --- a/source/blender/modifiers/intern/MOD_correctivesmooth.c +++ b/source/blender/modifiers/intern/MOD_correctivesmooth.cc @@ -62,7 +62,7 @@ static void initData(ModifierData *md) MEMCPY_STRUCT_AFTER(csmd, DNA_struct_default_get(CorrectiveSmoothModifierData), modifier); - csmd->delta_cache.deltas = NULL; + csmd->delta_cache.deltas = nullptr; } static void copyData(const ModifierData *md, ModifierData *target, const int flag) @@ -73,10 +73,10 @@ static void copyData(const ModifierData *md, ModifierData *target, const int fla BKE_modifier_copydata_generic(md, target, flag); if (csmd->bind_coords) { - tcsmd->bind_coords = MEM_dupallocN(csmd->bind_coords); + tcsmd->bind_coords = static_cast<float(*)[3]>(MEM_dupallocN(csmd->bind_coords)); } - tcsmd->delta_cache.deltas = NULL; + tcsmd->delta_cache.deltas = nullptr; tcsmd->delta_cache.deltas_num = 0; } @@ -135,7 +135,8 @@ static void mesh_get_boundaries(Mesh *mesh, float *smooth_weights) const uint medge_num = (uint)mesh->totedge; /* Flag boundary edges so only boundaries are set to 1. */ - uint8_t *boundaries = MEM_calloc_arrayN(medge_num, sizeof(*boundaries), __func__); + uint8_t *boundaries = static_cast<uint8_t *>( + MEM_calloc_arrayN(medge_num, sizeof(*boundaries), __func__)); for (uint i = 0; i < mpoly_num; i++) { const MPoly *p = &mpoly[i]; @@ -174,13 +175,14 @@ static void smooth_iter__simple(CorrectiveSmoothModifierData *csmd, const uint edges_num = (uint)mesh->totedge; const MEdge *edges = BKE_mesh_edges(mesh); - float *vertex_edge_count_div; struct SmoothingData_Simple { float delta[3]; - } *smooth_data = MEM_calloc_arrayN(verts_num, sizeof(*smooth_data), __func__); + }; + SmoothingData_Simple *smooth_data = MEM_cnew_array<SmoothingData_Simple>(verts_num, __func__); - vertex_edge_count_div = MEM_calloc_arrayN(verts_num, sizeof(float), __func__); + float *vertex_edge_count_div = static_cast<float *>( + MEM_calloc_arrayN(verts_num, sizeof(float), __func__)); /* calculate as f @@ Diff output truncated at 10240 characters. @@ _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs