diff options
Diffstat (limited to 'source/blender/editors')
19 files changed, 182 insertions, 177 deletions
diff --git a/source/blender/editors/gpencil/gpencil_bake_animation.cc b/source/blender/editors/gpencil/gpencil_bake_animation.cc index a163d95f46b..ad19ac94646 100644 --- a/source/blender/editors/gpencil/gpencil_bake_animation.cc +++ b/source/blender/editors/gpencil/gpencil_bake_animation.cc @@ -298,7 +298,7 @@ static int gpencil_bake_grease_pencil_animation_exec(bContext *C, wmOperator *op BLI_addtail(&gpl_dst->frames, gpf_dst); LISTBASE_FOREACH (bGPDstroke *, gps, &gpf_dst->strokes) { - gps->runtime.gps_orig = NULL; + gps->runtime.gps_orig = nullptr; /* Create material of the stroke. */ Material *ma_src = BKE_object_material_get(elem->ob, gps->mat_nr + 1); bool found = false; @@ -322,7 +322,7 @@ static int gpencil_bake_grease_pencil_animation_exec(bContext *C, wmOperator *op for (int j = 0; j < gps->totpoints; j++) { bGPDspoint *pt = &gps->points[j]; pt->runtime.idx_orig = 0; - pt->runtime.pt_orig = NULL; + pt->runtime.pt_orig = nullptr; mul_m4_v3(ob_eval->obmat, &pt->x); mul_m4_v3(invmat, &pt->x); } diff --git a/source/blender/editors/include/ED_uvedit.h b/source/blender/editors/include/ED_uvedit.h index 23cbcabbc0e..b499ae0ce59 100644 --- a/source/blender/editors/include/ED_uvedit.h +++ b/source/blender/editors/include/ED_uvedit.h @@ -107,7 +107,7 @@ bool uvedit_uv_select_test(const struct Scene *scene, struct BMLoop *l, int cd_l * Changes selection state of a single UV Face. */ void uvedit_face_select_set(const struct Scene *scene, - struct BMesh *em, + struct BMesh *bm, struct BMFace *efa, bool select, bool do_history, @@ -118,7 +118,7 @@ void uvedit_face_select_set(const struct Scene *scene, * Changes selection state of a single UV Edge. */ void uvedit_edge_select_set(const struct Scene *scene, - struct BMesh *em, + struct BMesh *bm, struct BMLoop *l, bool select, bool do_history, @@ -129,7 +129,7 @@ void uvedit_edge_select_set(const struct Scene *scene, * Changes selection state of a single UV vertex. */ void uvedit_uv_select_set(const struct Scene *scene, - struct BMesh *em, + struct BMesh *bm, struct BMLoop *l, bool select, bool do_history, diff --git a/source/blender/editors/interface/interface_ops.cc b/source/blender/editors/interface/interface_ops.cc index 6815f8689f5..8b29f1075b8 100644 --- a/source/blender/editors/interface/interface_ops.cc +++ b/source/blender/editors/interface/interface_ops.cc @@ -1578,7 +1578,7 @@ static bool jump_to_target_button(bContext *C, bool poll) int found = 0; /* Jump to target only works with search properties currently, not search callbacks yet. * See ui_but_add_search. */ - if (coll_search->search_prop != NULL) { + if (coll_search->search_prop != nullptr) { found = RNA_property_collection_lookup_string( &coll_search->search_ptr, coll_search->search_prop, str_ptr, &target_ptr); } diff --git a/source/blender/editors/mesh/editmesh_select.cc b/source/blender/editors/mesh/editmesh_select.cc index 86e104359f3..fcd3e579b06 100644 --- a/source/blender/editors/mesh/editmesh_select.cc +++ b/source/blender/editors/mesh/editmesh_select.cc @@ -546,7 +546,7 @@ BMEdge *EDBM_edge_find_nearest_ex(ViewContext *vc, return nullptr; } - NearestEdgeUserData data = {{0}}; + NearestEdgeUserData data = {{nullptr}}; const NearestEdgeUserData_Hit *hit = nullptr; /* interpolate along the edge before doing a clipping plane test */ const eV3DProjTest clip_flag = V3D_PROJ_TEST_CLIP_DEFAULT & ~V3D_PROJ_TEST_CLIP_BB; @@ -1414,9 +1414,9 @@ void MESH_OT_select_mode(wmOperatorType *ot) PropertyRNA *prop; static const EnumPropertyItem actions_items[] = { - {0, "DISABLE", 0, "Disable", "Disable selected markers"}, - {1, "ENABLE", 0, "Enable", "Enable selected markers"}, - {2, "TOGGLE", 0, "Toggle", "Toggle disabled flag for selected markers"}, + {0, "DISABLE", false, "Disable", "Disable selected markers"}, + {1, "ENABLE", false, "Enable", "Enable selected markers"}, + {2, "TOGGLE", false, "Toggle", "Toggle disabled flag for selected markers"}, {0, nullptr, 0, nullptr, nullptr}, }; @@ -1597,7 +1597,7 @@ void MESH_OT_loop_multi_select(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; /* properties */ - RNA_def_boolean(ot->srna, "ring", 0, "Ring", ""); + RNA_def_boolean(ot->srna, "ring", false, "Ring", ""); } /** \} */ @@ -1865,13 +1865,13 @@ void MESH_OT_loop_select(wmOperatorType *ot) /* properties */ PropertyRNA *prop; - prop = RNA_def_boolean(ot->srna, "extend", 0, "Extend Select", "Extend the selection"); + prop = RNA_def_boolean(ot->srna, "extend", false, "Extend Select", "Extend the selection"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); - prop = RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Remove from the selection"); + prop = RNA_def_boolean(ot->srna, "deselect", false, "Deselect", "Remove from the selection"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); - prop = RNA_def_boolean(ot->srna, "toggle", 0, "Toggle Select", "Toggle the selection"); + prop = RNA_def_boolean(ot->srna, "toggle", false, "Toggle Select", "Toggle the selection"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); - prop = RNA_def_boolean(ot->srna, "ring", 0, "Select Ring", "Select ring"); + prop = RNA_def_boolean(ot->srna, "ring", false, "Select Ring", "Select ring"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); } @@ -1891,11 +1891,11 @@ void MESH_OT_edgering_select(wmOperatorType *ot) /* Properties. */ PropertyRNA *prop; - prop = RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the selection"); + prop = RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend the selection"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); - prop = RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", "Remove from the selection"); + prop = RNA_def_boolean(ot->srna, "deselect", false, "Deselect", "Remove from the selection"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); - prop = RNA_def_boolean(ot->srna, "toggle", 0, "Toggle Select", "Toggle the selection"); + prop = RNA_def_boolean(ot->srna, "toggle", false, "Toggle Select", "Toggle the selection"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); prop = RNA_def_boolean(ot->srna, "ring", 1, "Select Ring", "Select ring"); RNA_def_property_flag(prop, PROP_SKIP_SAVE); @@ -3745,7 +3745,7 @@ void MESH_OT_select_linked_pick(wmOperatorType *ot) /* flags */ ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; - RNA_def_boolean(ot->srna, "deselect", 0, "Deselect", ""); + RNA_def_boolean(ot->srna, "deselect", false, "Deselect", ""); prop = RNA_def_enum_flag(ot->srna, "delimit", rna_enum_mesh_delimit_mode_items, @@ -3830,10 +3830,10 @@ static int edbm_select_face_by_sides_exec(bContext *C, wmOperator *op) void MESH_OT_select_face_by_sides(wmOperatorType *ot) { static const EnumPropertyItem type_items[] = { - {0, "LESS", 0, "Less Than", ""}, - {1, "EQUAL", 0, "Equal To", ""}, - {2, "GREATER", 0, "Greater Than", ""}, - {3, "NOTEQUAL", 0, "Not Equal To", ""}, + {0, "LESS", false, "Less Than", ""}, + {1, "EQUAL", false, "Equal To", ""}, + {2, "GREATER", false, "Greater Than", ""}, + {3, "NOTEQUAL", false, "Not Equal To", ""}, {0, nullptr, 0, nullptr, nullptr}, }; @@ -4023,7 +4023,7 @@ void MESH_OT_select_mirror(wmOperatorType *ot) /* props */ RNA_def_enum_flag(ot->srna, "axis", rna_enum_axis_flag_xyz_items, (1 << 0), "Axis", ""); - RNA_def_boolean(ot->srna, "extend", 0, "Extend", "Extend the existing selection"); + RNA_def_boolean(ot->srna, "extend", false, "Extend", "Extend the existing selection"); } /** \} */ @@ -5012,9 +5012,9 @@ static int edbm_select_axis_exec(bContext *C, wmOperator *op) void MESH_OT_select_axis(wmOperatorType *ot) { static const EnumPropertyItem axis_sign_items[] = { - {SELECT_AXIS_POS, "POS", 0, "Positive Axis", ""}, - {SELECT_AXIS_NEG, "NEG", 0, "Negative Axis", ""}, - {SELECT_AXIS_ALIGN, "ALIGN", 0, "Aligned Axis", ""}, + {SELECT_AXIS_POS, "POS", false, "Positive Axis", ""}, + {SELECT_AXIS_NEG, "NEG", false, "Negative Axis", ""}, + {SELECT_AXIS_ALIGN, "ALIGN", false, "Aligned Axis", ""}, {0, nullptr, 0, nullptr, nullptr}, }; @@ -5345,7 +5345,7 @@ void MESH_OT_loop_to_region(wmOperatorType *ot) RNA_def_boolean(ot->srna, "select_bigger", - 0, + false, "Select Bigger", "Select bigger regions instead of smaller ones"); } diff --git a/source/blender/editors/mesh/mesh_data.cc b/source/blender/editors/mesh/mesh_data.cc index 9dec3583763..122b8fa7d89 100644 --- a/source/blender/editors/mesh/mesh_data.cc +++ b/source/blender/editors/mesh/mesh_data.cc @@ -639,7 +639,7 @@ static int mesh_customdata_add_exec__internal(bContext *C, char htype, int type) BM_data_layer_add(mesh->edit_mesh->bm, data, type); } else { - CustomData_add_layer(data, type, CD_SET_DEFAULT, NULL, tot); + CustomData_add_layer(data, type, CD_SET_DEFAULT, nullptr, tot); } DEG_id_tag_update(&mesh->id, 0); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 271e94d48d4..a71358f4925 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -6100,23 +6100,23 @@ void SCULPT_fake_neighbors_free(Object *ob) void SCULPT_automasking_node_begin(Object *ob, const SculptSession *UNUSED(ss), AutomaskingCache *automasking, - AutomaskingNodeData *node_data, + AutomaskingNodeData *automask_data, PBVHNode *node) { if (!automasking) { - memset(node_data, 0, sizeof(*node_data)); + memset(automask_data, 0, sizeof(*automask_data)); return; } - node_data->node = node; - node_data->have_orig_data = automasking->settings.flags & - (BRUSH_AUTOMASKING_BRUSH_NORMAL | BRUSH_AUTOMASKING_VIEW_NORMAL); + automask_data->node = node; + automask_data->have_orig_data = automasking->settings.flags & + (BRUSH_AUTOMASKING_BRUSH_NORMAL | BRUSH_AUTOMASKING_VIEW_NORMAL); - if (node_data->have_orig_data) { - SCULPT_orig_vert_data_init(&node_data->orig_data, ob, node, SCULPT_UNDO_COORDS); + if (automask_data->have_orig_data) { + SCULPT_orig_vert_data_init(&automask_data->orig_data, ob, node, SCULPT_UNDO_COORDS); } else { - memset(&node_data->orig_data, 0, sizeof(node_data->orig_data)); + memset(&automask_data->orig_data, 0, sizeof(automask_data->orig_data)); } } diff --git a/source/blender/editors/sculpt_paint/sculpt_automasking.cc b/source/blender/editors/sculpt_paint/sculpt_automasking.cc index f0ce901e059..ea8cde9312a 100644 --- a/source/blender/editors/sculpt_paint/sculpt_automasking.cc +++ b/source/blender/editors/sculpt_paint/sculpt_automasking.cc @@ -170,7 +170,7 @@ static float sculpt_automasking_normal_calc(SculptSession *ss, return t; } - else if (angle > limit_upper) { + if (angle > limit_upper) { return 0.0f; } diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.cc b/source/blender/editors/sculpt_paint/sculpt_face_set.cc index 8ff84dabbbe..a85aa623519 100644 --- a/source/blender/editors/sculpt_paint/sculpt_face_set.cc +++ b/source/blender/editors/sculpt_paint/sculpt_face_set.cc @@ -271,12 +271,12 @@ void SCULPT_do_draw_face_sets_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, in /* Face Sets Operators */ -typedef enum eSculptFaceGroupsCreateModes { +enum eSculptFaceGroupsCreateModes { SCULPT_FACE_SET_MASKED = 0, SCULPT_FACE_SET_VISIBLE = 1, SCULPT_FACE_SET_ALL = 2, SCULPT_FACE_SET_SELECTION = 3, -} eSculptFaceGroupsCreateModes; +}; static EnumPropertyItem prop_sculpt_face_set_create_types[] = { { @@ -446,7 +446,7 @@ void SCULPT_OT_face_sets_create(wmOperatorType *ot) ot->srna, "mode", prop_sculpt_face_set_create_types, SCULPT_FACE_SET_MASKED, "Mode", ""); } -typedef enum eSculptFaceSetsInitMode { +enum eSculptFaceSetsInitMode { SCULPT_FACE_SETS_FROM_LOOSE_PARTS = 0, SCULPT_FACE_SETS_FROM_MATERIALS = 1, SCULPT_FACE_SETS_FROM_NORMALS = 2, @@ -456,7 +456,7 @@ typedef enum eSculptFaceSetsInitMode { SCULPT_FACE_SETS_FROM_BEVEL_WEIGHT = 6, SCULPT_FACE_SETS_FROM_FACE_MAPS = 7, SCULPT_FACE_SETS_FROM_FACE_SET_BOUNDARIES = 8, -} eSculptFaceSetsInitMode; +}; static EnumPropertyItem prop_sculpt_face_sets_init_types[] = { { @@ -771,12 +771,12 @@ void SCULPT_OT_face_sets_init(wmOperatorType *ot) 1.0f); } -typedef enum eSculptFaceGroupVisibilityModes { +enum eSculptFaceGroupVisibilityModes { SCULPT_FACE_SET_VISIBILITY_TOGGLE = 0, SCULPT_FACE_SET_VISIBILITY_SHOW_ACTIVE = 1, SCULPT_FACE_SET_VISIBILITY_HIDE_ACTIVE = 2, SCULPT_FACE_SET_VISIBILITY_INVERT = 3, -} eSculptFaceGroupVisibilityModes; +}; static EnumPropertyItem prop_sculpt_face_sets_change_visibility_types[] = { { @@ -1020,13 +1020,13 @@ void SCULPT_OT_face_sets_randomize_colors(wmOperatorType *ot) ot->flag = OPTYPE_REGISTER | OPTYPE_UNDO; } -typedef enum eSculptFaceSetEditMode { +enum eSculptFaceSetEditMode { SCULPT_FACE_SET_EDIT_GROW = 0, SCULPT_FACE_SET_EDIT_SHRINK = 1, SCULPT_FACE_SET_EDIT_DELETE_GEOMETRY = 2, SCULPT_FACE_SET_EDIT_FAIR_POSITIONS = 3, SCULPT_FACE_SET_EDIT_FAIR_TANGENCY = 4, -} eSculptFaceSetEditMode; +}; static EnumPropertyItem prop_sculpt_face_sets_edit_types[] = { { @@ -1132,7 +1132,9 @@ static void sculpt_face_set_shrink(Object *ob, } } -static bool check_single_face_set(SculptSession *ss, int *face_sets, const bool check_visible_only) +static bool check_single_face_set(SculptSession *ss, + const int *face_sets, + const bool check_visible_only) { if (face_sets == nullptr) { return true; diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index d84d7f2f6fb..edb681466b5 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -1353,7 +1353,7 @@ int SCULPT_automasking_settings_hash(Object *ob, AutomaskingCache *automasking); * fallback to euclidean distances to one of the initial vertices in the set. */ float *SCULPT_geodesic_distances_create(struct Object *ob, - struct GSet *initial_vertices, + struct GSet *initial_verts, float limit_radius); float *SCULPT_geodesic_from_vertex_and_symm(struct Sculpt *sd, struct Object *ob, diff --git a/source/blender/editors/space_file/filelist.cc b/source/blender/editors/space_file/filelist.cc index d72d7cb14d0..c2dc8e9196d 100644 --- a/source/blender/editors/space_file/filelist.cc +++ b/source/blender/editors/space_file/filelist.cc @@ -572,7 +572,7 @@ void filelist_sort(struct FileList *filelist) break; } - FileSortData sort_data{0}; + FileSortData sort_data{}; sort_data.inverted = (filelist->flags & FL_SORT_INVERT) != 0; BLI_listbase_sort_r(&filelist->filelist_intern.entries, sort_cb, &sort_data); @@ -804,7 +804,7 @@ static void prepare_filter_asset_library(const FileList *filelist, FileListFilte static bool asset_tag_matches_filter(const char *filter_search, const AssetMetaData *asset_data) { LISTBASE_FOREACH (const AssetTag *, asset_tag, &asset_data->tags) { - if (BLI_strcasestr(asset_tag->name, filter_search) != NULL) { + if (BLI_strcasestr(asset_tag->name, filter_search) != nullptr) { return true; } } @@ -832,7 +832,7 @@ static bool is_filtered_asset(FileListInternEntry *file, FileListFilter *filter) /* When doing a name comparison, get rid of the leading/trailing asterisks. */ filter_search[string_length - 1] = '\0'; - if (BLI_strcasestr(file->name, filter_search + 1) != NULL) { + if (BLI_strcasestr(file->name, filter_search + 1) != nullptr) { return true; } return asset_tag_matches_filter(filter_search + 1, asset_data); @@ -909,7 +909,7 @@ void filelist_filter(FileList *filelist) /* Never show lib ID 'categories' directories when we are in 'flat' mode, unless * root path is a blend file. */ char dir[FILE_MAX_LIBEXTRA]; - if (!filelist_islibrary(filelist, dir, NULL)) { + if (!filelist_islibrary(filelist, dir, nullptr)) { filelist->filter_data.flags |= FLF_HIDE_LIB_DIR; } } @@ -1041,7 +1041,7 @@ static bool filelist_compare_asset_libraries(const AssetLibraryReference *librar /* Don't only check the index, also check that it's valid. */ bUserAssetLibrary *library_ptr_a = BKE_preferences_asset_library_find_from_index( &U, library_a->custom_library_index); - return (library_ptr_a != NULL) && + return (library_ptr_a != nullptr) && (library_a->custom_library_index == library_b->custom_library_index); } @@ -1082,10 +1082,13 @@ void filelist_init_icons(void) BLI_assert(G.background == false); #ifdef WITH_HEADLESS - bbuf = NULL; + bbuf = nullptr; #else - bbuf = IMB_ibImageFromMemory( - (const uchar *)datatoc_prvicons_png, datatoc_prvicons_png_size, IB_rect, NULL, "<splash>"); + bbuf = IMB_ibImageFromMemory((const uchar *)datatoc_prvicons_png, + datatoc_prvicons_png_size, + IB_rect, + nullptr, + "<splash>"); #endif if (bbuf) { for (y = 0; y < SPECIAL_IMG_ROWS; y++) { @@ -1113,7 +1116,7 @@ void filelist_free_icons(void) for (int i = 0; i < SPECIAL_IMG_MAX; i++) { IMB_freeImBuf(gSpecialFileImages[i]); - gSpecialFileImages[i] = NULL; + gSpecialFileImages[i] = nullptr; } } @@ -1128,17 +1131,17 @@ ImBuf *filelist_getimage(struct FileList *filelist, const int index) { FileDirEntry *file = filelist_geticon_get_file(filelist, index); - return file->preview_icon_id ? BKE_icon_imbuf_get_buffer(file->preview_icon_id) : NULL; + return file->preview_icon_id ? BKE_icon_imbuf_get_buffer(file->preview_icon_id) : nullptr; } ImBuf *filelist_file_getimage(const FileDirEntry *file) { - return file->preview_icon_id ? BKE_icon_imbuf_get_buffer(file->preview_icon_id) : NULL; + return file->preview_icon_id ? BKE_icon_imbuf_get_buffer(file->preview_icon_id) : nullptr; } ImBuf *filelist_geticon_image_ex(const FileDirEntry *file) { - ImBuf *ibuf = NULL; + ImBuf *ibuf = nullptr; if (file->typeflag & FILE_TYPE_DIR) { if (FILENAME_IS_PARENT(file->relpath)) { @@ -1287,12 +1290,12 @@ int filelist_geticon(struct FileList *filelist, const int index, const bool is_m int ED_file_icon(const FileDirEntry *file) { return file->preview_icon_id ? file->preview_icon_id : - filelist_geticon_ex(file, NULL, false, false); + filelist_geticon_ex(file, nullptr, false, false); } static bool filelist_intern_entry_is_main_file(const FileListInternEntry *intern_entry) { - return intern_entry->local_data.id != NULL; + return intern_entry->local_data.id != nullptr; } /* ********** Main ********** */ @@ -1327,7 +1330,7 @@ static bool filelist_checkdir_lib(struct FileList * /*filelist*/, char *name; const bool is_valid = (BLI_is_dir(r_dir) || - (BLO_library_path_explode(r_dir, tdir, NULL, &name) && + (BLO_library_path_explode(r_dir, tdir, nullptr, &name) && BLI_is_file(tdir) && !name)); if (do_change && !is_valid) { @@ -1484,7 +1487,7 @@ static void filelist_cache_preview_runf(TaskPool *__restrict pool, void *taskdat } /* Move ownership to the done queue. */ - preview_taskdata->preview = NULL; + preview_taskdata->preview = nullptr; BLI_thread_queue_push(cache->previews_done, preview); @@ -1543,8 +1546,8 @@ static void filelist_cache_previews_free(FileListEntryCache *cache) BLI_thread_queue_free(cache->previews_done); BLI_task_pool_free(cache->previews_pool); - cache->previews_pool = NULL; - cache->previews_done = NULL; + cache->previews_pool = nullptr; + cache->previews_done = nullptr; cache->previews_todo_count = 0; IMB_thumb_locks_release(); @@ -1654,10 +1657,10 @@ static void filelist_cache_free(FileListEntryCache *cache) MEM_freeN(cache->block_entries); - BLI_ghash_free(cache->misc_entries, NULL, NULL); + BLI_ghash_free(cache->misc_entries, nullptr, nullptr); MEM_freeN(cache->misc_entries_indices); - BLI_ghash_free(cache->uids, NULL, NULL); + BLI_ghash_free(cache->uids, nullptr, nullptr); LISTBASE_FOREACH_MUTABLE (FileDirEntry *, entry, &cache->cached_entries) { filelist_entry_free(entry); @@ -1680,14 +1683,14 @@ static void filelist_cache_clear(FileListEntryCache *cache, size_t new_size) MEM_reallocN(cache->block_entries, sizeof(*cache->block_entries) * new_size)); } - BLI_ghash_clear_ex(cache->misc_entries, NULL, NULL, new_size); + BLI_ghash_clear_ex(cache->misc_entries, nullptr, nullptr, new_size); if (new_size != cache->size) { cache->misc_entries_indices = static_cast<int *>(MEM_reallocN( cache->misc_entries_indices, sizeof(*cache->misc_entries_indices) * new_size)); } copy_vn_i(cache->misc_entries_indices, new_size, -1); - BLI_ghash_clear_ex(cache->uids, NULL, NULL, new_size * 2); + BLI_ghash_clear_ex(cache->uids, nullptr, nullptr, new_size * 2); cache->size = new_size; @@ -1723,13 +1726,13 @@ void filelist_settype(FileList *filelist, short type) case FILE_MAIN: filelist->check_dir_fn = filelist_checkdir_main; filelist->read_job_fn = filelist_readjob_main; - filelist->prepare_filter_fn = NULL; + filelist->prepare_filter_fn = nullptr; filelist->filter_fn = is_filtered_main; break; case FILE_LOADLIB: filelist->check_dir_fn = filelist_checkdir_lib; filelist->read_job_fn = filelist_readjob_lib; - filelist->prepare_filter_fn = NULL; + filelist->prepare_filter_fn = nullptr; filelist->filter_fn = is_filtered_lib; break; case FILE_ASSET_LIBRARY: @@ -1749,7 +1752,7 @@ void filelist_settype(FileList *filelist, short type) default: filelist->check_dir_fn = filelist_checkdir_dir; filelist->read_job_fn = filelist_readjob_dir; - filelist->prepare_filter_fn = NULL; + filelist->prepare_filter_fn = nullptr; filelist->filter_fn = is_filtered_file; break; } @@ -1760,7 +1763,7 @@ void filelist_settype(FileList *filelist, short type) static void filelist_clear_asset_library(FileList *filelist) { /* The AssetLibraryService owns the AssetLibrary pointer, so no need for us to free it. */ - filelist->asset_library = NULL; + filelist->asset_library = nullptr; file_delete_asset_catalog_filter_settings(&filelist->filter_data.asset_catalog_filter); } @@ -1784,7 +1787,7 @@ void filelist_clear_ex(struct FileList *filelist, filelist_direntryarr_free(&filelist->filelist); if (do_selection && filelist->selection_state) { - BLI_ghash_clear(filelist->selection_state, NULL, NULL); + BLI_ghash_clear(filelist->selection_state, nullptr, nullptr); } if (do_asset_library) { @@ -1814,7 +1817,7 @@ static void filelist_clear_main_files(FileList *filelist, BLI_assert(filelist->filelist.entries_num > FILEDIR_NBR_ENTRIES_UNSET); if (do_selection && filelist->selection_state) { - BLI_ghash_clear(filelist->selection_state, NULL, NULL); + BLI_ghash_clear(filelist->selection_state, nullptr, nullptr); } if (do_asset_library) { @@ -1853,8 +1856,8 @@ void filelist_free(struct FileList *filelist) filelist_cache_free(&filelist->filelist_cache); if (filelist->selection_state) { - BLI_ghash_free(filelist->selection_state, NULL, NULL); - filelist->selection_state = NULL; + BLI_ghash_free(filelist->selection_state, nullptr, nullptr); + filelist->selection_state = nullptr; } MEM_SAFE_FREE(filelist->asset_library_ref); @@ -1874,7 +1877,7 @@ void filelist_freelib(struct FileList *filelist) if (filelist->libfiledata) { BLO_blendhandle_close(filelist->libfiledata); } - filelist->libfiledata = NULL; + filelist->libfiledata = nullptr; } BlendHandle *filelist_lib(struct FileList *filelist) @@ -1887,7 +1890,7 @@ static char *fileentry_uiname(const char *root, const eFileSel_File_Types typeflag, char *buff) { - char *name = NULL; + char *name = nullptr; if (typeflag & FILE_TYPE_FTFONT && !(typeflag & FILE_TYPE_BLENDERLIB)) { char abspath[FILE_MAX_LIBEXTRA]; @@ -1935,7 +1938,7 @@ bool filelist_is_dir(struct FileList *filelist, const char *path) void filelist_setdir(struct FileList *filelist, char *r_dir) { - const bool allow_invalid = filelist->asset_library_ref != NULL; + const bool allow_invalid = filelist->asset_library_ref != nullptr; BLI_assert(strlen(r_dir) < FILE_MAX_LIBEXTRA); BLI_path_normalize_dir(BKE_main_blendfile_path_from_global(), r_dir); @@ -2027,8 +2030,8 @@ static FileDirEntry *filelist_file_create_entry(FileList *filelist, const int in ret->redirection_path = BLI_strdup(entry->redirection_path); } ret->id = entry->local_data.id; - ret->asset_data = entry->imported_asset_data ? entry->imported_asset_data : NULL; - if (ret->id && (ret->asset_data == NULL)) { + ret->asset_data = entry->imported_asset_data ? entry->imported_asset_data : nullptr; + if (ret->id && (ret->asset_data == nullptr)) { ret->asset_data = ret->id->asset_data; } /* For some file types the preview is already available. */ @@ -2051,7 +2054,7 @@ static void filelist_file_release_entry(FileList *filelist, FileDirEntry *entry) FileDirEntry *filelist_file_ex(struct FileList *filelist, const int index, const bool use_request) { - FileDirEntry *ret = NULL, *old; + FileDirEntry *ret = nullptr, *old; FileListEntryCache *cache = &filelist->filelist_cache; const size_t cache_size = cache->size; int old_index; @@ -2071,7 +2074,7 @@ FileDirEntry *filelist_file_ex(struct FileList *filelist, const int index, const } if (!use_request) { - return NULL; + return nullptr; } // printf("requesting file %d (not yet cached)\n", index); @@ -2080,8 +2083,8 @@ FileDirEntry *filelist_file_ex(struct FileList *filelist, const int index, const ret = filelist_file_create_entry(filelist, index); old_index = cache->misc_entries_indices[cache->misc_cursor]; if ((old = static_cast<FileDirEntry *>( - BLI_ghash_popkey(cache->misc_entries, POINTER_FROM_INT(old_index), NULL)))) { - BLI_ghash_remove(cache->uids, POINTER_FROM_UINT(old->uid), NULL, NULL); + BLI_ghash_popkey(cache->misc_entries, POINTER_FROM_INT(old_index), nullptr)))) { + BLI_ghash_remove(cache->uids, POINTER_FROM_UINT(old->uid), nullptr, nullptr); filelist_file_release_entry(filelist, old); } BLI_ghash_insert(cache->misc_entries, POINTER_FROM_INT(index), ret); @@ -2198,8 +2201,8 @@ static bool filelist_file_cache_block_create(FileList *filelist, FileDirEntry *entry; /* That entry might have already been requested and stored in misc cache... */ - if ((entry = static_cast<FileDirEntry *>( - BLI_ghash_popkey(cache->misc_entries, POINTER_FROM_INT(idx), NULL))) == NULL) { + if ((entry = static_cast<FileDirEntry *>(BLI_ghash_popkey( + cache->misc_entries, POINTER_FROM_INT(idx), nullptr))) == nullptr) { entry = filelist_file_create_entry(filelist, idx); BLI_ghash_insert(cache->uids, POINTER_FROM_UINT(entry->uid), entry); } @@ -2227,10 +2230,10 @@ static void filelist_file_cache_block_release(struct FileList *filelist, __func__, cursor /*, cache->block_entries[cursor], cache->block_entries[cursor]->relpath*/); #endif - BLI_ghash_remove(cache->uids, POINTER_FROM_UINT(entry->uid), NULL, NULL); + BLI_ghash_remove(cache->uids, POINTER_FROM_UINT(entry->uid), nullptr, nullptr); filelist_file_release_entry(filelist, entry); #ifndef NDEBUG - cache->block_entries[cursor] = NULL; + cache->block_entries[cursor] = nullptr; #endif } } @@ -2461,7 +2464,7 @@ void filelist_cache_previews_set(FileList *filelist, const bool use_previews) if (use_previews && (filelist->flags & FL_IS_READY)) { cache->flags |= FLC_PREVIEWS_ACTIVE; - BLI_assert((cache->previews_pool == NULL) && (cache->previews_done == NULL) && + BLI_assert((cache->previews_pool == nullptr) && (cache->previews_done == nullptr) && (cache->previews_todo_count == 0)); // printf("%s: Init Previews...\n", __func__); @@ -2537,7 +2540,7 @@ bool filelist_cache_previews_running(FileList *filelist) { FileListEntryCache *cache = &filelist->filelist_cache; - return (cache->previews_pool != NULL); + return (cache->previews_pool != nullptr); } bool filelist_cache_previews_done(FileList *filelist) @@ -2548,7 +2551,7 @@ bool filelist_cache_previews_done(FileList *filelist) return false; } - return (cache->previews_pool == NULL) || (cache->previews_done == NULL) || + return (cache->previews_pool == nullptr) || (cache->previews_done == nullptr) || (cache->previews_todo_count == 0); } @@ -2557,7 +2560,7 @@ static bool file_is_blend_backup(const char *str) { const size_t a = strlen(str); size_t b = 7; - bool retval = 0; + bool retval = false; if (a == 0 || b >= a) { /* pass */ @@ -2573,7 +2576,7 @@ static bool file_is_blend_backup(const char *str) loc = BLI_strcasestr(str + a - b, ".blend"); if (loc) { - retval = 1; + retval = true; } } @@ -2594,7 +2597,7 @@ int ED_path_extension_type(const char *path) ".app", /* Safari in-progress/paused download */ ".download", - NULL)) { + nullptr)) { return FILE_TYPE_BUNDLE; } #endif @@ -2611,11 +2614,11 @@ int ED_path_extension_type(const char *path) ".mcr", ".inc", ".fountain", - NULL)) { + nullptr)) { return FILE_TYPE_TEXT; } if (BLI_path_extension_check_n( - path, ".ttf", ".ttc", ".pfb", ".otf", ".otc", ".woff", ".woff2", NULL)) { + path, ".ttf", ".ttc", ".pfb", ".otf", ".otc", ".woff", ".woff2", nullptr)) { return FILE_TYPE_FTFONT; } if (BLI_path_extension_check(path, ".btx")) { @@ -2627,7 +2630,7 @@ int ED_path_extension_type(const char *path) if (BLI_path_extension_check(path, ".abc")) { return FILE_TYPE_ALEMBIC; } - if (BLI_path_extension_check_n(path, ".usd", ".usda", ".usdc", NULL)) { + if (BLI_path_extension_check_n(path, ".usd", ".usda", ".usdc", nullptr)) { return FILE_TYPE_USD; } if (BLI_path_extension_check(path, ".vdb")) { @@ -2637,7 +2640,7 @@ int ED_path_extension_type(const char *path) return FILE_TYPE_ARCHIVE; } if (BLI_path_extension_check_n( - path, ".obj", ".mtl", ".3ds", ".fbx", ".glb", ".gltf", ".svg", ".stl", NULL)) { + path, ".obj", ".mtl", ".3ds", ".fbx", ".glb", ".gltf", ".svg", ".stl", nullptr)) { return FILE_TYPE_OBJECT_IO; } if (BLI_path_extension_check_array(path, imb_ext_image)) { @@ -2706,7 +2709,7 @@ uint filelist_entry_select_set(const FileList *filelist, uint flag, FileCheckType check) { - /* Default NULL pointer if not found is fine here! */ + /* Default nullptr pointer if not found is fine here! */ void **es_p = BLI_ghash_lookup_p(filelist->selection_state, POINTER_FROM_UINT(entry->uid)); uint entry_flag = es_p ? POINTER_AS_UINT(*es_p) : 0; const uint org_entry_flag = entry_flag; @@ -2735,7 +2738,8 @@ uint filelist_entry_select_set(const FileList *filelist, *es_p = POINTER_FROM_UINT(entry_flag); } else { - BLI_ghash_remove(filelist->selection_state, POINTER_FROM_UINT(entry->uid), NULL, NULL); + BLI_ghash_remove( + filelist->selection_state, POINTER_FROM_UINT(entry->uid), nullptr, nullptr); } } else if (entry_flag) { @@ -2777,7 +2781,7 @@ uint filelist_entry_select_get(FileList *filelist, FileDirEntry *entry, FileChec if ((check == CHECK_ALL) || ((check == CHECK_DIRS) && (entry->typeflag & FILE_TYPE_DIR)) || ((check == CHECK_FILES) && !(entry->typeflag & FILE_TYPE_DIR))) { - /* Default NULL pointer if not found is fine here! */ + /* Default nullptr pointer if not found is fine here! */ return POINTER_AS_UINT( BLI_ghash_lookup(filelist->selection_state, POINTER_FROM_UINT(entry->uid))); } @@ -2801,7 +2805,7 @@ bool filelist_entry_is_selected(FileList *filelist, const int index) BLI_assert(index >= 0 && index < filelist->filelist.entries_filtered_num); FileListInternEntry *intern_entry = filelist->filelist_intern.filtered[index]; - /* BLI_ghash_lookup returns NULL if not found, which gets mapped to 0, which gets mapped to + /* BLI_ghash_lookup returns nullptr if not found, which gets mapped to 0, which gets mapped to * "not selected". */ const uint selection_state = POINTER_AS_UINT( BLI_ghash_lookup(filelist->selection_state, POINTER_FROM_UINT(intern_entry->uid))); @@ -2821,7 +2825,7 @@ void filelist_entry_parent_select_set(FileList *filelist, bool filelist_islibrary(struct FileList *filelist, char *dir, char **r_group) { - return BLO_library_path_explode(filelist->filelist.root, dir, r_group, NULL); + return BLO_library_path_explode(filelist->filelist.root, dir, r_group, nullptr); } static int groupname_to_code(const char *group) @@ -2852,10 +2856,10 @@ static uint64_t groupname_to_filter_id(const char *group) * i.e. have to be careful about sharing stuff between background working thread. * and main one (used by UI among other things). */ -typedef struct TodoDir { +struct TodoDir { int level; char *dir; -} TodoDir; +}; static int filelist_readjob_list_dir(const char *root, ListBase *entries, @@ -2915,7 +2919,7 @@ static int filelist_readjob_list_dir(const char *root, } else { MEM_freeN(entry->redirection_path); - entry->redirection_path = NULL; + entry->redirection_path = nullptr; entry->attributes |= FILE_ATTR_HIDDEN; } } @@ -2952,7 +2956,7 @@ static int filelist_readjob_list_dir(const char *root, return entries_num; } -typedef enum ListLibOptions { +enum ListLibOptions { LIST_LIB_OPTION_NONE = 0, /* Will read both the groups + actual ids from the library. Reduces the amount of times that @@ -2964,7 +2968,7 @@ typedef enum ListLibOptions { /* Add given root as result. */ LIST_LIB_ADD_PARENT = (1 << 2), -} ListLibOptions; +}; ENUM_OPERATORS(ListLibOptions, LIST_LIB_ADD_PARENT); static FileListInternEntry *filelist_readjob_list_lib_group_create(const int idcode, @@ -3074,19 +3078,19 @@ static int filelist_readjob_list_lib(const char *root, char dir[FILE_MAX_LIBEXTRA], *group; - struct BlendHandle *libfiledata = NULL; + struct BlendHandle *libfiledata = nullptr; /* Check if the given root is actually a library. All folders are passed to * `filelist_readjob_list_lib` and based on the number of found entries `filelist_readjob_do` * will do a dir listing only when this function does not return any entries. */ /* TODO(jbakker): We should consider introducing its own function to detect if it is a lib and * call it directly from `filelist_readjob_do` to increase readability. */ - const bool is_lib = BLO_library_path_explode(root, dir, &group, NULL); + const bool is_lib = BLO_library_path_explode(root, dir, &group, nullptr); if (!is_lib) { return 0; } - const bool group_came_from_path = group != NULL; + const bool group_came_from_path = group != nullptr; /* Try read from indexer_runtime. */ /* Indexing returns all entries in a blend file. We should ignore the index when listing a group @@ -3097,7 +3101,7 @@ static int filelist_readjob_list_lib(const char *root, * Adding support for partial reading/updating indexes would increase the complexity. */ const bool use_indexer = !group_came_from_path; - FileIndexerEntries indexer_entries = {NULL}; + FileIndexerEntries indexer_entries = {nullptr}; if (use_indexer) { int read_from_index = 0; eFileIndexerResult indexer_result = indexer_runtime->callbacks->read_index( @@ -3113,7 +3117,7 @@ static int filelist_readjob_list_lib(const char *root, /* Open the library file. */ BlendFileReadReport bf_reports{}; libfiledata = BLO_blendhandle_from_file(dir, &bf_reports); - if (libfiledata == NULL) { + if (libfiledata == nullptr) { return 0; } @@ -3186,13 +3190,13 @@ static int filelist_readjob_list_lib(const char *root, static void filelist_readjob_main_recursive(Main *bmain, FileList *filelist) { ID *id; - FileDirEntry *files, *firstlib = NULL; + FileDirEntry *files, *firstlib = nullptr; ListBase *lb; int a, fake, idcode, ok, totlib, totbl; // filelist->type = FILE_MAIN; /* XXX TODO: add modes to file-browser */ - BLI_assert(filelist->filelist.entries == NULL); + BLI_assert(filelist->filelist.entries == nullptr); if (filelist->filelist.root[0] == '/') { filelist->filelist.root[0] = '\0'; @@ -3253,7 +3257,7 @@ static void filelist_readjob_main_recursive(Main *bmain, FileList *filelist) idcode = groupname_to_code(filelist->filelist.root); lb = which_libbase(bmain, idcode); - if (lb == NULL) { + if (lb == nullptr) { return; } @@ -3352,11 +3356,11 @@ static void filelist_readjob_main_recursive(Main *bmain, FileList *filelist) } #endif -typedef struct FileListReadJob { +struct FileListReadJob { ThreadMutex lock; char main_name[FILE_MAX]; Main *current_main; - struct FileList *filelist; + FileList *filelist; /** Set to request a partial read that only adds files representing #Main data (IDs). Used when * #Main may have received changes of interest (e.g. asset removed or renamed). */ bool only_main_data; @@ -3370,9 +3374,9 @@ typedef struct FileListReadJob { * and moved to #filelist once all categories are loaded. * * NOTE: #tmp_filelist is freed in #filelist_readjob_free, so any copied pointers need to be - * set to NULL to avoid double-freeing them. */ - struct FileList *tmp_filelist; -} FileListReadJob; + * set to nullptr to avoid double-freeing them. */ + FileList *tmp_filelist; +}; static void filelist_readjob_append_entries(FileListReadJob *job_params, ListBase *from_entries, @@ -3437,7 +3441,7 @@ static void filelist_readjob_recursive_dir_add_items(const bool do_lib, float *progress) { FileList *filelist = job_params->tmp_filelist; /* Use the thread-safe filelist queue. */ - ListBase entries = {0}; + ListBase entries = {nullptr}; BLI_Stack *todo_dirs; TodoDir *td_dir; char dir[FILE_MAX_LIBEXTRA]; @@ -3553,7 +3557,7 @@ static void filelist_readjob_recursive_dir_add_items(const bool do_lib, } if (indexer_runtime.callbacks->free_user_data && indexer_runtime.user_data) { indexer_runtime.callbacks->free_user_data(indexer_runtime.user_data); - indexer_runtime.user_data = NULL; + indexer_runtime.user_data = nullptr; } /* If we were interrupted by stop, stack may not be empty and we need to free @@ -3574,7 +3578,7 @@ static void filelist_readjob_do(const bool do_lib, { FileList *filelist = job_params->tmp_filelist; /* Use the thread-safe filelist queue. */ - // BLI_assert(filelist->filtered == NULL); + // BLI_assert(filelist->filtered == nullptr); BLI_assert(BLI_listbase_is_empty(&filelist->filelist.entries) && (filelist->filelist.entries_num == FILEDIR_NBR_ENTRIES_UNSET)); @@ -3623,10 +3627,10 @@ static void filelist_readjob_load_asset_library_data(FileListReadJob *job_params *do_update = false; - if (job_params->filelist->asset_library_ref == NULL) { + if (job_params->filelist->asset_library_ref == nullptr) { return; } - if (tmp_filelist->asset_library != NULL) { + if (tmp_filelist->asset_library != nullptr) { /* Asset library already loaded. */ return; } @@ -3774,14 +3778,14 @@ static void filelist_readjob_startjob(void *flrjv, short *stop, short *do_update BLI_mutex_lock(&flrj->lock); - BLI_assert((flrj->tmp_filelist == NULL) && flrj->filelist); + BLI_assert((flrj->tmp_filelist == nullptr) && flrj->filelist); flrj->tmp_filelist = static_cast<FileList *>(MEM_dupallocN(flrj->filelist)); BLI_listbase_clear(&flrj->tmp_filelist->filelist.entries); flrj->tmp_filelist->filelist.entries_num = FILEDIR_NBR_ENTRIES_UNSET; - flrj->tmp_filelist->filelist_intern.filtered = NULL; + flrj->tmp_filelist->filelist_intern.filtered = nullptr; BLI_listbase_clear(&flrj->tmp_filelist->filelist_intern.entries); if (filelist_readjob_is_partial_read(flrj)) { /* Don't unset the current UID on partial read, would give duplicates otherwise. */ @@ -3790,11 +3794,11 @@ static void filelist_readjob_startjob(void *flrjv, short *stop, short *do_update filelist_uid_unset(&flrj->tmp_filelist->filelist_intern.curr_uid); } - flrj->tmp_filelist->libfiledata = NULL; + flrj->tmp_filelist->libfiledata = nullptr; memset(&flrj->tmp_filelist->filelist_cache, 0, sizeof(flrj->tmp_filelist->filelist_cache)); - flrj->tmp_filelist->selection_state = NULL; - flrj->tmp_filelist->asset_library_ref = NULL; - flrj->tmp_filelist->filter_data.asset_catalog_filter = NULL; + flrj->tmp_filelist->selection_state = nullptr; + flrj->tmp_filelist->asset_library_ref = nullptr; + flrj->tmp_filelist->filter_data.asset_catalog_filter = nullptr; BLI_mutex_unlock(&flrj->lock); @@ -3810,7 +3814,7 @@ static void filelist_readjob_update(void *flrjv) { FileListReadJob *flrj = static_cast<FileListReadJob *>(flrjv); FileListIntern *fl_intern = &flrj->filelist->filelist_intern; - ListBase new_entries = {NULL}; + ListBase new_entries = {nullptr}; int entries_num, new_entries_num = 0; BLI_movelisttolist(&new_entries, &fl_intern->entries); @@ -3922,7 +3926,7 @@ void filelist_readjob_start(FileList *filelist, const int space_notifier, const filelist_readjob_endjob(flrj); filelist_readjob_free(flrj); - WM_event_add_notifier(C, space_notifier | NA_JOB_FINISHED, NULL); + WM_event_add_notifier(C, space_notifier | NA_JOB_FINISHED, nullptr); return; } @@ -3935,8 +3939,11 @@ void filelist_readjob_start(FileList *filelist, const int space_notifier, const WM_JOB_TYPE_FILESEL_READDIR); WM_jobs_customdata_set(wm_job, flrj, filelist_readjob_free); WM_jobs_timer(wm_job, 0.01, space_notifier, space_notifier | NA_JOB_FINISHED); - WM_jobs_callbacks( - wm_job, filelist_readjob_startjob, NULL, filelist_readjob_update, filelist_readjob_endjob); + WM_jobs_callbacks(wm_job, + filelist_readjob_startjob, + nullptr, + filelist_readjob_update, + filelist_readjob_endjob); /* start the job */ WM_jobs_start(CTX_wm_manager(C), wm_job); diff --git a/source/blender/editors/space_file/folder_history.cc b/source/blender/editors/space_file/folder_history.cc index 1cb8fa279c5..8f44c0aa08a 100644 --- a/source/blender/editors/space_file/folder_history.cc +++ b/source/blender/editors/space_file/folder_history.cc @@ -27,15 +27,15 @@ /** \name FOLDERLIST (previous/next) * \{ */ -typedef struct FolderList { - struct FolderList *next, *prev; +struct FolderList { + FolderList *next, *prev; char *foldername; -} FolderList; +}; void folderlist_popdir(struct ListBase *folderlist, char *dir) { const char *prev_dir; - struct FolderList *folder; + FolderList *folder; folder = static_cast<FolderList *>(folderlist->last); if (folder) { @@ -58,7 +58,7 @@ void folderlist_pushdir(ListBase *folderlist, const char *dir) return; } - struct FolderList *folder, *previous_folder; + FolderList *folder, *previous_folder; previous_folder = static_cast<FolderList *>(folderlist->last); /* check if already exists */ @@ -78,10 +78,10 @@ void folderlist_pushdir(ListBase *folderlist, const char *dir) const char *folderlist_peeklastdir(ListBase *folderlist) { - struct FolderList *folder; + FolderList *folder; if (!folderlist->last) { - return NULL; + return nullptr; } folder = static_cast<FolderList *>(folderlist->last); @@ -91,7 +91,7 @@ const char *folderlist_peeklastdir(ListBase *folderlist) bool folderlist_clear_next(struct SpaceFile *sfile) { const FileSelectParams *params = ED_fileselect_get_active_params(sfile); - struct FolderList *folder; + FolderList *folder; /* if there is no folder_next there is nothing we can clear */ if (BLI_listbase_is_empty(sfile->folders_next)) { @@ -121,7 +121,7 @@ void folderlist_free(ListBase *folderlist) static ListBase folderlist_duplicate(ListBase *folderlist) { - ListBase folderlistn = {NULL}; + ListBase folderlistn = {nullptr}; BLI_duplicatelist(&folderlistn, folderlist); @@ -145,7 +145,7 @@ static FileFolderHistory *folder_history_find(const SpaceFile *sfile, eFileBrows } } - return NULL; + return nullptr; } void folder_history_list_ensure_for_active_browse_mode(SpaceFile *sfile) @@ -165,10 +165,10 @@ void folder_history_list_ensure_for_active_browse_mode(SpaceFile *sfile) static void folder_history_entry_free(SpaceFile *sfile, FileFolderHistory *history) { if (sfile->folders_prev == &history->folders_prev) { - sfile->folders_prev = NULL; + sfile->folders_prev = nullptr; } if (sfile->folders_next == &history->folders_next) { - sfile->folders_next = NULL; + sfile->folders_next = nullptr; } folderlist_free(&history->folders_prev); folderlist_free(&history->folders_next); @@ -184,7 +184,7 @@ void folder_history_list_free(SpaceFile *sfile) ListBase folder_history_list_duplicate(ListBase *listbase) { - ListBase histories = {NULL}; + ListBase histories = {nullptr}; LISTBASE_FOREACH (FileFolderHistory *, history, listbase) { FileFolderHistory *history_new = static_cast<FileFolderHistory *>(MEM_dupallocN(history)); diff --git a/source/blender/editors/space_info/info_stats.cc b/source/blender/editors/space_info/info_stats.cc index fb744071a8e..81fa5cc2303 100644 --- a/source/blender/editors/space_info/info_stats.cc +++ b/source/blender/editors/space_info/info_stats.cc @@ -410,7 +410,7 @@ static void stats_update(Depsgraph *depsgraph, else { /* Objects. */ GSet *objects_gset = BLI_gset_new(BLI_ghashutil_ptrhash, BLI_ghashutil_ptrcmp, __func__); - DEGObjectIterSettings deg_iter_settings = {0}; + DEGObjectIterSettings deg_iter_settings{}; deg_iter_settings.depsgraph = depsgraph; deg_iter_settings.flags = DEG_OBJECT_ITER_FOR_RENDER_ENGINE_FLAGS; DEG_OBJECT_ITER_BEGIN (°_iter_settings, ob_iter) { diff --git a/source/blender/editors/space_node/node_add.cc b/source/blender/editors/space_node/node_add.cc index 984f9647b34..943fc99a7f6 100644 --- a/source/blender/editors/space_node/node_add.cc +++ b/source/blender/editors/space_node/node_add.cc @@ -777,7 +777,7 @@ static int new_node_tree_exec(bContext *C, wmOperator *op) ED_node_tree_update(C); } - WM_event_add_notifier(C, NC_NODE | NA_ADDED, NULL); + WM_event_add_notifier(C, NC_NODE | NA_ADDED, nullptr); return OPERATOR_FINISHED; } diff --git a/source/blender/editors/space_node/node_group.cc b/source/blender/editors/space_node/node_group.cc index 7de02f5d6b8..aedceb1d368 100644 --- a/source/blender/editors/space_node/node_group.cc +++ b/source/blender/editors/space_node/node_group.cc @@ -1045,7 +1045,7 @@ static int node_group_make_exec(bContext *C, wmOperator *op) ED_node_tree_propagate_change(C, bmain, nullptr); - WM_event_add_notifier(C, NC_NODE | NA_ADDED, NULL); + WM_event_add_notifier(C, NC_NODE | NA_ADDED, nullptr); /* We broke relations in node tree, need to rebuild them in the graphs. */ DEG_relations_tag_update(bmain); diff --git a/source/blender/editors/space_outliner/outliner_dragdrop.cc b/source/blender/editors/space_outliner/outliner_dragdrop.cc index 20e3eb0009d..259d879d76f 100644 --- a/source/blender/editors/space_outliner/outliner_dragdrop.cc +++ b/source/blender/editors/space_outliner/outliner_dragdrop.cc @@ -1571,7 +1571,7 @@ void OUTLINER_OT_item_drag_drop(wmOperatorType *ot) /** \name Drop Boxes * \{ */ -void outliner_dropboxes(void) +void outliner_dropboxes() { ListBase *lb = WM_dropboxmap_find("Outliner", SPACE_OUTLINER, RGN_TYPE_WINDOW); diff --git a/source/blender/editors/space_spreadsheet/space_spreadsheet.cc b/source/blender/editors/space_spreadsheet/space_spreadsheet.cc index b094222b16e..c546a371ef0 100644 --- a/source/blender/editors/space_spreadsheet/space_spreadsheet.cc +++ b/source/blender/editors/space_spreadsheet/space_spreadsheet.cc @@ -248,10 +248,8 @@ static void spreadsheet_update_context(const bContext *C) /* The pinned path is still valid, do nothing. */ break; } - else { - /* The pinned path does not exist anymore, clear pinning. */ - sspreadsheet->flag &= ~SPREADSHEET_FLAG_PINNED; - } + /* The pinned path does not exist anymore, clear pinning. */ + sspreadsheet->flag &= ~SPREADSHEET_FLAG_PINNED; } else { /* Unknown pinned path, clear pinning. */ @@ -266,11 +264,9 @@ static void spreadsheet_update_context(const bContext *C) /* Nothing changed. */ break; } - else { - /* Update the viewer path from the workspace. */ - BKE_viewer_path_clear(&sspreadsheet->viewer_path); - BKE_viewer_path_copy(&sspreadsheet->viewer_path, &workspace->viewer_path); - } + /* Update the viewer path from the workspace. */ + BKE_viewer_path_clear(&sspreadsheet->viewer_path); + BKE_viewer_path_copy(&sspreadsheet->viewer_path, &workspace->viewer_path); } else { /* No active viewer node, change back to showing evaluated active object. */ diff --git a/source/blender/editors/space_view3d/space_view3d.cc b/source/blender/editors/space_view3d/space_view3d.cc index 672922ac3e5..4ac6f926818 100644 --- a/source/blender/editors/space_view3d/space_view3d.cc +++ b/source/blender/editors/space_view3d/space_view3d.cc @@ -8,8 +8,8 @@ /* Allow using deprecated functionality for .blend file I/O. */ #define DNA_DEPRECATED_ALLOW -#include <stdio.h> -#include <string.h> +#include <cstdio> +#include <cstring> #include "DNA_collection_types.h" #include "DNA_defaults.h" @@ -881,7 +881,7 @@ static void view3d_lightcache_update(bContext *C) } /* region dropbox definition */ -static void view3d_dropboxes(void) +static void view3d_dropboxes() { ListBase *lb = WM_dropboxmap_find("View3D", SPACE_VIEW3D, RGN_TYPE_WINDOW); @@ -959,7 +959,7 @@ static void view3d_dropboxes(void) nullptr); } -static void view3d_widgets(void) +static void view3d_widgets() { wmGizmoMapType_Params params{SPACE_VIEW3D, RGN_TYPE_WINDOW}; wmGizmoMapType *gzmap_type = WM_gizmomaptype_ensure(¶ms); @@ -1367,7 +1367,7 @@ static void view3d_main_region_message_subscribe(const wmRegionMessageSubscribeP * accepting some redundant redraws. * * For other space types we might try avoid this, keep the 3D view as an exceptional case! */ - wmMsgParams_RNA msg_key_params = {{0}}; + wmMsgParams_RNA msg_key_params{}; /* Only subscribe to types. */ StructRNA *type_array[] = { @@ -1563,7 +1563,7 @@ static void view3d_header_region_message_subscribe(const wmRegionMessageSubscrib struct wmMsgBus *mbus = params->message_bus; ARegion *region = params->region; - wmMsgParams_RNA msg_key_params = {{0}}; + wmMsgParams_RNA msg_key_params{}; /* Only subscribe to types. */ StructRNA *type_array[] = { @@ -2048,7 +2048,7 @@ static void view3d_blend_write(BlendWriter *writer, SpaceLink *sl) BKE_viewer_path_blend_write(writer, &v3d->viewer_path); } -void ED_spacetype_view3d(void) +void ED_spacetype_view3d() { SpaceType *st = MEM_cnew<SpaceType>("spacetype view3d"); ARegionType *art; diff --git a/source/blender/editors/space_view3d/view3d_draw.cc b/source/blender/editors/space_view3d/view3d_draw.cc index ab77cf3407a..33129dfff5d 100644 --- a/source/blender/editors/space_view3d/view3d_draw.cc +++ b/source/blender/editors/space_view3d/view3d_draw.cc @@ -5,7 +5,7 @@ * \ingroup spview3d */ -#include <math.h> +#include <cmath> #include "BLI_jitter_2d.h" #include "BLI_listbase.h" diff --git a/source/blender/editors/uvedit/uvedit_islands.cc b/source/blender/editors/uvedit/uvedit_islands.cc index c226ad4c461..2648ec5e2f6 100644 --- a/source/blender/editors/uvedit/uvedit_islands.cc +++ b/source/blender/editors/uvedit/uvedit_islands.cc @@ -126,7 +126,7 @@ static float (*bm_face_array_calc_unique_uv_coords( BMEdge *e_first = v_pivot->e; const BMEdge *e = e_first; do { - if (e->l != NULL) { + if (e->l != nullptr) { const BMLoop *l_radial = e->l; do { if (l_radial->v == l_iter->v) { @@ -368,7 +368,7 @@ int bm_mesh_calc_uv_islands(const Scene *scene, const int group_len = BM_mesh_calc_face_groups(bm, groups_array, &group_index, - NULL, + nullptr, bm_loop_uv_shared_edge_check, &user_data, hflag_face_test, @@ -435,7 +435,7 @@ void ED_uvedit_pack_islands_multi(const Scene *scene, } } - ListBase island_list = {NULL}; + ListBase island_list = {nullptr}; bm_mesh_calc_uv_islands(scene, em->bm, &island_list, @@ -536,7 +536,7 @@ void ED_uvedit_pack_islands_multi(const Scene *scene, float base_offset[2] = {0.0f, 0.0f}; /* CASE: ignore UDIM. */ - if (udim_params == NULL) { + if (udim_params == nullptr) { /* pass */ } /* CASE: Active/specified(smart uv project) UDIM. */ |