Commit: 2627635ff3aeb790f3d653f1a52c652066764bda Author: Campbell Barton Date: Mon Feb 6 12:46:53 2023 +1100 Branches: master https://developer.blender.org/rB2627635ff3aeb790f3d653f1a52c652066764bda
Cleanup: use nullptr in C++ =================================================================== M source/blender/blenkernel/intern/cdderivedmesh.cc M source/blender/blenkernel/intern/mesh_mirror.cc M source/blender/blenkernel/intern/subdiv_converter_mesh.cc M source/blender/draw/engines/workbench/workbench_shadow.cc M source/blender/draw/engines/workbench/workbench_state.cc M source/blender/editors/sculpt_paint/sculpt.cc M source/blender/editors/sculpt_paint/sculpt_undo.cc M source/blender/modifiers/intern/MOD_explode.cc =================================================================== diff --git a/source/blender/blenkernel/intern/cdderivedmesh.cc b/source/blender/blenkernel/intern/cdderivedmesh.cc index 9cf5f7ecedf..2a98dbe6fb9 100644 --- a/source/blender/blenkernel/intern/cdderivedmesh.cc +++ b/source/blender/blenkernel/intern/cdderivedmesh.cc @@ -131,7 +131,7 @@ static void cdDM_recalc_looptri(DerivedMesh *dm) BLI_assert(cddm->dm.looptris.array == NULL); atomic_cas_ptr( (void **)&cddm->dm.looptris.array, cddm->dm.looptris.array, cddm->dm.looptris.array_wip); - cddm->dm.looptris.array_wip = NULL; + cddm->dm.looptris.array_wip = nullptr; } static void cdDM_free_internal(CDDerivedMesh *cddm) @@ -232,7 +232,7 @@ static DerivedMesh *cdDM_from_mesh_ex(Mesh *mesh, #if 0 cddm->mface = CustomData_get_layer(&dm->faceData, CD_MFACE); #else - cddm->mface = NULL; + cddm->mface = nullptr; #endif /* commented since even when CD_ORIGINDEX was first added this line fails diff --git a/source/blender/blenkernel/intern/mesh_mirror.cc b/source/blender/blenkernel/intern/mesh_mirror.cc index 21b8ab83ebd..95f8008a4f9 100644 --- a/source/blender/blenkernel/intern/mesh_mirror.cc +++ b/source/blender/blenkernel/intern/mesh_mirror.cc @@ -204,7 +204,7 @@ Mesh *BKE_mesh_mirror_apply_mirror_on_axis_for_modifier(MirrorModifierData *mmd, /* Subdivision-surface for eg won't have mesh data in the custom-data arrays. * Now add position/#MEdge/#MPoly layers. */ - if (BKE_mesh_vert_positions(mesh) != NULL) { + if (BKE_mesh_vert_positions(mesh) != nullptr) { memcpy(BKE_mesh_vert_positions_for_write(result), BKE_mesh_vert_positions(mesh), sizeof(float[3]) * mesh->totvert); diff --git a/source/blender/blenkernel/intern/subdiv_converter_mesh.cc b/source/blender/blenkernel/intern/subdiv_converter_mesh.cc index 05fa391dcaa..8be3f128e10 100644 --- a/source/blender/blenkernel/intern/subdiv_converter_mesh.cc +++ b/source/blender/blenkernel/intern/subdiv_converter_mesh.cc @@ -161,7 +161,7 @@ static float get_edge_sharpness(const OpenSubdiv_Converter *converter, int manif return 10.0f; } #endif - if (!storage->settings.use_creases || storage->cd_edge_crease == NULL) { + if (!storage->settings.use_creases || storage->cd_edge_crease == nullptr) { return 0.0f; } const int edge_index = storage->manifold_edge_index_reverse[manifold_edge_index]; @@ -184,7 +184,7 @@ static bool is_infinite_sharp_vertex(const OpenSubdiv_Converter *converter, static float get_vertex_sharpness(const OpenSubdiv_Converter *converter, int manifold_vertex_index) { ConverterStorage *storage = static_cast<ConverterStorage *>(converter->user_data); - if (!storage->settings.use_creases || storage->cd_vertex_crease == NULL) { + if (!storage->settings.use_creases || storage->cd_vertex_crease == nullptr) { return 0.0f; } const int vertex_index = storage->manifold_vertex_index_reverse[manifold_vertex_index]; @@ -208,7 +208,7 @@ static void precalc_uv_layer(const OpenSubdiv_Converter *converter, const int la const int num_vert = mesh->totvert; const float limit[2] = {STD_UV_CONNECT_LIMIT, STD_UV_CONNECT_LIMIT}; /* Initialize memory required for the operations. */ - if (storage->loop_uv_indices == NULL) { + if (storage->loop_uv_indices == nullptr) { storage->loop_uv_indices = static_cast<int *>( MEM_malloc_arrayN(mesh->totloop, sizeof(int), "loop uv vertex index")); } @@ -227,7 +227,7 @@ static void precalc_uv_layer(const OpenSubdiv_Converter *converter, const int la storage->num_uv_coordinates = -1; for (int vertex_index = 0; vertex_index < num_vert; vertex_index++) { const UvMapVert *uv_vert = BKE_mesh_uv_vert_map_get_vert(uv_vert_map, vertex_index); - while (uv_vert != NULL) { + while (uv_vert != nullptr) { if (uv_vert->separate) { storage->num_uv_coordinates++; } @@ -287,17 +287,17 @@ static void init_functions(OpenSubdiv_Converter *converter) converter->getNumFaceVertices = get_num_face_vertices; converter->getFaceVertices = get_face_vertices; - converter->getFaceEdges = NULL; + converter->getFaceEdges = nullptr; converter->getEdgeVertices = get_edge_vertices; - converter->getNumEdgeFaces = NULL; - converter->getEdgeFaces = NULL; + converter->getNumEdgeFaces = nullptr; + converter->getEdgeFaces = nullptr; converter->getEdgeSharpness = get_edge_sharpness; - converter->getNumVertexEdges = NULL; - converter->getVertexEdges = NULL; - converter->getNumVertexFaces = NULL; - converter->getVertexFaces = NULL; + converter->getNumVertexEdges = nullptr; + converter->getVertexEdges = nullptr; + converter->getNumVertexFaces = nullptr; + converter->getVertexFaces = nullptr; converter->isInfiniteSharpVertex = is_infinite_sharp_vertex; converter->getVertexSharpness = get_vertex_sharpness; @@ -316,36 +316,36 @@ static void initialize_manifold_index_array(const BLI_bitmap *used_map, int **r_indices_reverse, int *r_num_manifold_elements) { - int *indices = NULL; - if (r_indices != NULL) { + int *indices = nullptr; + if (r_indices != nullptr) { indices = static_cast<int *>(MEM_malloc_arrayN(num_elements, sizeof(int), "manifold indices")); } - int *indices_reverse = NULL; - if (r_indices_reverse != NULL) { + int *indices_reverse = nullptr; + if (r_indices_reverse != nullptr) { indices_reverse = static_cast<int *>( MEM_malloc_arrayN(num_elements, sizeof(int), "manifold indices reverse")); } int offset = 0; for (int i = 0; i < num_elements; i++) { if (BLI_BITMAP_TEST_BOOL(used_map, i)) { - if (indices != NULL) { + if (indices != nullptr) { indices[i] = i - offset; } - if (indices_reverse != NULL) { + if (indices_reverse != nullptr) { indices_reverse[i - offset] = i; } } else { - if (indices != NULL) { + if (indices != nullptr) { indices[i] = -1; } offset++; } } - if (r_indices != NULL) { + if (r_indices != nullptr) { *r_indices = indices; } - if (r_indices_reverse != NULL) { + if (r_indices_reverse != nullptr) { *r_indices_reverse = indices_reverse; } *r_num_manifold_elements = num_elements - offset; @@ -375,7 +375,7 @@ static void initialize_manifold_indices(ConverterStorage *storage) &storage->num_manifold_vertices); initialize_manifold_index_array(edge_used_map, mesh->totedge, - NULL, + nullptr, &storage->manifold_edge_index_reverse, &storage->num_manifold_edges); /* Initialize infinite sharp mapping. */ @@ -408,7 +408,7 @@ static void init_user_data(OpenSubdiv_Converter *converter, CustomData_get_layer(&mesh->vdata, CD_CREASE)); user_data->cd_edge_crease = static_cast<const float *>( CustomData_get_layer(&mesh->edata, CD_CREASE)); - user_data->loop_uv_indices = NULL; + user_data->loop_uv_indices = nullptr; initialize_manifold_indices(user_data); converter->user_data = user_data; } diff --git a/source/blender/draw/engines/workbench/workbench_shadow.cc b/source/blender/draw/engines/workbench/workbench_shadow.cc index 61eda4dce58..623cf90f863 100644 --- a/source/blender/draw/engines/workbench/workbench_shadow.cc +++ b/source/blender/draw/engines/workbench/workbench_shadow.cc @@ -351,7 +351,7 @@ void ShadowPass::init(const SceneState &scene_state, SceneResources &resources) /* Shadow direction. */ float4x4 view_matrix; - DRW_view_viewmat_get(NULL, view_matrix.ptr(), false); + DRW_view_viewmat_get(nullptr, view_matrix.ptr(), false); resources.world_buf.shadow_direction_vs = float4(view_matrix.ref_3x3() * direction_ws); /* Clamp to avoid overshadowing and shading errors. */ diff --git a/source/blender/draw/engines/workbench/workbench_state.cc b/source/blender/draw/engines/workbench/workbench_state.cc index 3b44abd03a7..5e214084346 100644 --- a/source/blender/draw/engines/workbench/workbench_state.cc +++ b/source/blender/draw/engines/workbench/workbench_state.cc @@ -242,7 +242,7 @@ ObjectState::ObjectState(const SceneState &scene_state, Object *ob) /* Bad call C is required to access the tool system that is context aware. Cast to non-const * due to current API. */ bContext *C = (bContext *)DRW_context_state_get()->evil_C; - if (C != NULL) { + if (C != nullptr) { color_type = ED_paint_shading_color_override( C, &scene_state.scene->toolsettings->paint_mode, ob, color_type); } diff --git a/source/blender/editors/sculpt_paint/sculpt.cc b/source/blender/editors/sculpt_paint/sculpt.cc index 43fdc56fe3d..b5d3e53b00c 100644 --- a/source/blender/editors/sculpt_paint/sculpt.cc +++ b/source/blender/editors/sculpt_paint/sculpt.cc @@ -3471,7 +3471,7 @@ static void do_brush_action(Sculpt *sd, { SculptSession *ss = ob->sculpt; int totnode, texnodes_num = 0; - PBVHNode **nodes, **texnodes = NULL; + PBVHNode **nodes, **texnodes = nullptr; /* Check for unsupported features. */ PBVHType type = BKE_pbvh_type(ss->pbvh); diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.cc b/source/blender/editors/sculpt_paint/sculpt_undo.cc index 24c49962df8..302ec4a2005 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.cc +++ b/source/blender/editors/sculpt_paint/sculpt_undo.cc @@ -305,7 +305,8 @@ static void update_cb_partial(PBVHNode *node, void *userdata) int *node_grid_indices; int totgrid; bool update = false; - BKE_pbvh_node_get_grids(data->pbvh, node, &node_grid_indices, &totgrid, NULL, NULL, NULL); + BKE_pbvh_node_get_grids( + data->pbvh, node, &node_grid_indices, &totgrid, nullptr, nullptr, nullptr); for (int i = 0; i < totgrid; i++) { if (data->modified_grids[node_grid_indices[i]] == 1) { update = true; @@ -320,9 +321,9 @@ static void update_cb_partial(PBVHNode *node, void *userdata) BKE_pbvh_node_mark_update(node); } int verts_num; - BKE_pbvh_node_num_verts(data->pbvh, node, NULL, &ve @@ 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