From a9b2cf8ce63b4d0d466628b89fbbac51c5296e7e Mon Sep 17 00:00:00 2001 From: Bastien Montagne Date: Fri, 9 Feb 2024 19:23:03 +0100 Subject: [PATCH] Cleanup: Move `BKE_path.h` to CPP header. --- .../blenkernel/{BKE_bpath.h => BKE_bpath.hh} | 53 +++++++------------ source/blender/blenkernel/CMakeLists.txt | 2 +- source/blender/blenkernel/intern/blendfile.cc | 2 +- source/blender/blenkernel/intern/bpath.cc | 2 +- .../blender/blenkernel/intern/bpath_test.cc | 2 +- source/blender/blenkernel/intern/brush.cc | 2 +- source/blender/blenkernel/intern/cachefile.cc | 2 +- source/blender/blenkernel/intern/image.cc | 2 +- source/blender/blenkernel/intern/lib_id.cc | 2 +- source/blender/blenkernel/intern/library.cc | 2 +- source/blender/blenkernel/intern/main.cc | 2 +- source/blender/blenkernel/intern/mesh.cc | 2 +- source/blender/blenkernel/intern/movieclip.cc | 2 +- source/blender/blenkernel/intern/node.cc | 2 +- source/blender/blenkernel/intern/object.cc | 2 +- source/blender/blenkernel/intern/scene.cc | 2 +- source/blender/blenkernel/intern/sound.cc | 2 +- source/blender/blenkernel/intern/text.cc | 2 +- source/blender/blenkernel/intern/vfont.cc | 2 +- source/blender/blenkernel/intern/volume.cc | 2 +- source/blender/blenloader/intern/writefile.cc | 2 +- .../blender/editors/asset/intern/asset_ops.cc | 2 +- source/blender/editors/space_info/info_ops.cc | 2 +- source/blender/python/intern/bpy.cc | 2 +- 24 files changed, 43 insertions(+), 56 deletions(-) rename source/blender/blenkernel/{BKE_bpath.h => BKE_bpath.hh} (84%) diff --git a/source/blender/blenkernel/BKE_bpath.h b/source/blender/blenkernel/BKE_bpath.hh similarity index 84% rename from source/blender/blenkernel/BKE_bpath.h rename to source/blender/blenkernel/BKE_bpath.hh index d7275594449..b84edc5d774 100644 --- a/source/blender/blenkernel/BKE_bpath.h +++ b/source/blender/blenkernel/BKE_bpath.hh @@ -16,10 +16,6 @@ #include "BLI_utildefines.h" -#ifdef __cplusplus -extern "C" { -#endif - struct ID; struct Main; struct ReportList; @@ -27,7 +23,7 @@ struct ReportList; /** \name Core `foreach_path` API. * \{ */ -typedef enum eBPathForeachFlag { +enum eBPathForeachFlag { /* Flags controlling the behavior of the generic BPath API. */ /** * Ensures the `absolute_base_path` member of #BPathForeachPathData is initialized properly with @@ -62,7 +58,7 @@ typedef enum eBPathForeachFlag { * \note Only used by Image #IDType currently. */ BKE_BPATH_FOREACH_PATH_RELOAD_EDITED = (1 << 9), -} eBPathForeachFlag; +}; ENUM_OPERATORS(eBPathForeachFlag, BKE_BPATH_FOREACH_PATH_RELOAD_EDITED) struct BPathForeachPathData; @@ -79,14 +75,14 @@ struct BPathForeachPathData; * \return `true` if the path has been changed, and in that case, * result must be written to `path_dst`. */ -typedef bool (*BPathForeachPathFunctionCallback)(struct BPathForeachPathData *bpath_data, +typedef bool (*BPathForeachPathFunctionCallback)(BPathForeachPathData *bpath_data, char *path_dst, size_t path_dst_maxncpy, const char *path_src); /** Storage for common data needed across the BPath 'foreach_path' code. */ -typedef struct BPathForeachPathData { - struct Main *bmain; +struct BPathForeachPathData { + Main *bmain; BPathForeachPathFunctionCallback callback_function; eBPathForeachFlag flag; @@ -100,16 +96,16 @@ typedef struct BPathForeachPathData { const char *absolute_base_path; /** ID owning the path being processed. */ - struct ID *owner_id; + ID *owner_id; /** * IDTypeInfo callbacks are responsible to set this boolean if they modified one or more paths. */ bool is_path_modified; -} BPathForeachPathData; +}; /** Run `bpath_data.callback_function` on all paths contained in `id`. */ -void BKE_bpath_foreach_path_id(BPathForeachPathData *bpath_data, struct ID *id); +void BKE_bpath_foreach_path_id(BPathForeachPathData *bpath_data, ID *id); /** Run `bpath_data.callback_function` on all paths of all IDs in `bmain`. */ void BKE_bpath_foreach_path_main(BPathForeachPathData *bpath_data); @@ -129,7 +125,7 @@ void BKE_bpath_foreach_path_main(BPathForeachPathData *bpath_data); * * \return true is \a path was modified, false otherwise. */ -bool BKE_bpath_foreach_path_fixed_process(struct BPathForeachPathData *bpath_data, +bool BKE_bpath_foreach_path_fixed_process(BPathForeachPathData *bpath_data, char *path, size_t path_maxncpy); @@ -142,7 +138,7 @@ bool BKE_bpath_foreach_path_fixed_process(struct BPathForeachPathData *bpath_dat * * \return true is \a path_dir and/or \a path_file were modified, false otherwise. */ -bool BKE_bpath_foreach_path_dirfile_fixed_process(struct BPathForeachPathData *bpath_data, +bool BKE_bpath_foreach_path_dirfile_fixed_process(BPathForeachPathData *bpath_data, char *path_dir, size_t path_dir_maxncpy, char *path_file, @@ -157,8 +153,7 @@ bool BKE_bpath_foreach_path_dirfile_fixed_process(struct BPathForeachPathData *b * * \return true is \a path was modified and re-allocated, false otherwise. */ -bool BKE_bpath_foreach_path_allocated_process(struct BPathForeachPathData *bpath_data, - char **path); +bool BKE_bpath_foreach_path_allocated_process(BPathForeachPathData *bpath_data, char **path); /** \} */ @@ -166,7 +161,7 @@ bool BKE_bpath_foreach_path_allocated_process(struct BPathForeachPathData *bpath * \{ */ /** Check for missing files. */ -void BKE_bpath_missing_files_check(struct Main *bmain, struct ReportList *reports); +void BKE_bpath_missing_files_check(Main *bmain, ReportList *reports); /** * Recursively search into given search directory, for all file paths of all IDs in given @@ -181,33 +176,29 @@ void BKE_bpath_missing_files_check(struct Main *bmain, struct ReportList *report * \param find_all: If `true`, also search for files which current path is still valid, if `false` * skip those still valid paths. */ -void BKE_bpath_missing_files_find(struct Main *bmain, +void BKE_bpath_missing_files_find(Main *bmain, const char *searchpath, - struct ReportList *reports, + ReportList *reports, bool find_all); /** Rebase all relative file paths in given \a bmain from \a basedir_src to \a basedir_dst. */ -void BKE_bpath_relative_rebase(struct Main *bmain, +void BKE_bpath_relative_rebase(Main *bmain, const char *basedir_src, const char *basedir_dst, - struct ReportList *reports); + ReportList *reports); /** Make all absolute file paths in given \a bmain relative to given \a basedir. */ -void BKE_bpath_relative_convert(struct Main *bmain, - const char *basedir, - struct ReportList *reports); +void BKE_bpath_relative_convert(Main *bmain, const char *basedir, ReportList *reports); /** Make all relative file paths in given \a bmain absolute, using given \a basedir as root. */ -void BKE_bpath_absolute_convert(struct Main *bmain, - const char *basedir, - struct ReportList *reports); +void BKE_bpath_absolute_convert(Main *bmain, const char *basedir, ReportList *reports); /** * Temp backup of paths from all IDs in given \a bmain. * * \return An opaque handle to pass to #BKE_bpath_list_restore and #BKE_bpath_list_free. */ -void *BKE_bpath_list_backup(struct Main *bmain, eBPathForeachFlag flag); +void *BKE_bpath_list_backup(Main *bmain, eBPathForeachFlag flag); /** * Restore the temp backup of paths from \a path_list_handle into all IDs in given \a bmain. @@ -216,7 +207,7 @@ void *BKE_bpath_list_backup(struct Main *bmain, eBPathForeachFlag flag); * addition/deletion/re-ordering of IDs, or their file paths) since the call to * #BKE_bpath_list_backup that generated the given \a path_list_handle. */ -void BKE_bpath_list_restore(struct Main *bmain, eBPathForeachFlag flag, void *path_list_handle); +void BKE_bpath_list_restore(Main *bmain, eBPathForeachFlag flag, void *path_list_handle); /** * Free the temp backup of paths in \a path_list_handle. @@ -227,7 +218,3 @@ void BKE_bpath_list_restore(struct Main *bmain, eBPathForeachFlag flag, void *pa void BKE_bpath_list_free(void *path_list_handle); /** \} */ - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/blenkernel/CMakeLists.txt b/source/blender/blenkernel/CMakeLists.txt index c49c3ced01b..f7075003da8 100644 --- a/source/blender/blenkernel/CMakeLists.txt +++ b/source/blender/blenkernel/CMakeLists.txt @@ -349,7 +349,7 @@ set(SRC BKE_blendfile.hh BKE_blendfile_link_append.hh BKE_boids.h - BKE_bpath.h + BKE_bpath.hh BKE_brush.hh BKE_bvhutils.hh BKE_cachefile.h diff --git a/source/blender/blenkernel/intern/blendfile.cc b/source/blender/blenkernel/intern/blendfile.cc index a3c924380f6..b653b17bab4 100644 --- a/source/blender/blenkernel/intern/blendfile.cc +++ b/source/blender/blenkernel/intern/blendfile.cc @@ -34,7 +34,7 @@ #include "BKE_blender.hh" #include "BKE_blender_version.h" #include "BKE_blendfile.hh" -#include "BKE_bpath.h" +#include "BKE_bpath.hh" #include "BKE_colorband.hh" #include "BKE_context.hh" #include "BKE_global.h" diff --git a/source/blender/blenkernel/intern/bpath.cc b/source/blender/blenkernel/intern/bpath.cc index 4d94ac261e4..c731299d38e 100644 --- a/source/blender/blenkernel/intern/bpath.cc +++ b/source/blender/blenkernel/intern/bpath.cc @@ -65,7 +65,7 @@ #include "BKE_report.h" #include "BKE_vfont.hh" -#include "BKE_bpath.h" /* own include */ +#include "BKE_bpath.hh" /* own include */ #include "CLG_log.h" diff --git a/source/blender/blenkernel/intern/bpath_test.cc b/source/blender/blenkernel/intern/bpath_test.cc index e2012d692a1..08a726f140c 100644 --- a/source/blender/blenkernel/intern/bpath_test.cc +++ b/source/blender/blenkernel/intern/bpath_test.cc @@ -5,7 +5,7 @@ #include "CLG_log.h" -#include "BKE_bpath.h" +#include "BKE_bpath.hh" #include "BKE_idtype.hh" #include "BKE_lib_id.hh" #include "BKE_main.hh" diff --git a/source/blender/blenkernel/intern/brush.cc b/source/blender/blenkernel/intern/brush.cc index 5e166b4552f..4bf366af038 100644 --- a/source/blender/blenkernel/intern/brush.cc +++ b/source/blender/blenkernel/intern/brush.cc @@ -21,7 +21,7 @@ #include "BLT_translation.hh" -#include "BKE_bpath.h" +#include "BKE_bpath.hh" #include "BKE_brush.hh" #include "BKE_colortools.hh" #include "BKE_context.hh" diff --git a/source/blender/blenkernel/intern/cachefile.cc b/source/blender/blenkernel/intern/cachefile.cc index 1247182e8b3..58ce9d0f54a 100644 --- a/source/blender/blenkernel/intern/cachefile.cc +++ b/source/blender/blenkernel/intern/cachefile.cc @@ -25,7 +25,7 @@ #include "BLT_translation.hh" #include "BKE_anim_data.h" -#include "BKE_bpath.h" +#include "BKE_bpath.hh" #include "BKE_cachefile.h" #include "BKE_idtype.hh" #include "BKE_lib_id.hh" diff --git a/source/blender/blenkernel/intern/image.cc b/source/blender/blenkernel/intern/image.cc index eef61ac47a7..ce44e7daf5a 100644 --- a/source/blender/blenkernel/intern/image.cc +++ b/source/blender/blenkernel/intern/image.cc @@ -62,7 +62,7 @@ #include "BLT_translation.hh" -#include "BKE_bpath.h" +#include "BKE_bpath.hh" #include "BKE_colortools.hh" #include "BKE_global.h" #include "BKE_icons.h" diff --git a/source/blender/blenkernel/intern/lib_id.cc b/source/blender/blenkernel/intern/lib_id.cc index fa55341b9e4..9cb12c3be77 100644 --- a/source/blender/blenkernel/intern/lib_id.cc +++ b/source/blender/blenkernel/intern/lib_id.cc @@ -43,7 +43,7 @@ #include "BKE_anim_data.h" #include "BKE_armature.hh" #include "BKE_asset.hh" -#include "BKE_bpath.h" +#include "BKE_bpath.hh" #include "BKE_context.hh" #include "BKE_global.h" #include "BKE_gpencil_legacy.h" diff --git a/source/blender/blenkernel/intern/library.cc b/source/blender/blenkernel/intern/library.cc index 0cab6881689..7a1c15e11e0 100644 --- a/source/blender/blenkernel/intern/library.cc +++ b/source/blender/blenkernel/intern/library.cc @@ -21,7 +21,7 @@ #include "BLT_translation.hh" -#include "BKE_bpath.h" +#include "BKE_bpath.hh" #include "BKE_idtype.hh" #include "BKE_lib_id.hh" #include "BKE_lib_query.hh" diff --git a/source/blender/blenkernel/intern/main.cc b/source/blender/blenkernel/intern/main.cc index ae4d61fe5bb..5fa454be4a9 100644 --- a/source/blender/blenkernel/intern/main.cc +++ b/source/blender/blenkernel/intern/main.cc @@ -24,7 +24,7 @@ #include "DNA_ID.h" -#include "BKE_bpath.h" +#include "BKE_bpath.hh" #include "BKE_global.h" #include "BKE_idtype.hh" #include "BKE_lib_id.hh" diff --git a/source/blender/blenkernel/intern/mesh.cc b/source/blender/blenkernel/intern/mesh.cc index df1065bcc25..9feaca98c56 100644 --- a/source/blender/blenkernel/intern/mesh.cc +++ b/source/blender/blenkernel/intern/mesh.cc @@ -45,7 +45,7 @@ #include "BKE_anim_data.h" #include "BKE_attribute.hh" #include "BKE_bake_data_block_id.hh" -#include "BKE_bpath.h" +#include "BKE_bpath.hh" #include "BKE_deform.hh" #include "BKE_editmesh.hh" #include "BKE_editmesh_cache.hh" diff --git a/source/blender/blenkernel/intern/movieclip.cc b/source/blender/blenkernel/intern/movieclip.cc index 34d1502acc1..f6f21cce548 100644 --- a/source/blender/blenkernel/intern/movieclip.cc +++ b/source/blender/blenkernel/intern/movieclip.cc @@ -45,7 +45,7 @@ #include "BLT_translation.hh" #include "BKE_anim_data.h" -#include "BKE_bpath.h" +#include "BKE_bpath.hh" #include "BKE_colortools.hh" #include "BKE_global.h" #include "BKE_idtype.hh" diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc index 9cdfff78e0e..470a3958c3c 100644 --- a/source/blender/blenkernel/intern/node.cc +++ b/source/blender/blenkernel/intern/node.cc @@ -54,7 +54,7 @@ #include "BKE_anim_data.h" #include "BKE_animsys.h" #include "BKE_asset.hh" -#include "BKE_bpath.h" +#include "BKE_bpath.hh" #include "BKE_colortools.hh" #include "BKE_context.hh" #include "BKE_cryptomatte.h" diff --git a/source/blender/blenkernel/intern/object.cc b/source/blender/blenkernel/intern/object.cc index 0a5211e0871..b065032298a 100644 --- a/source/blender/blenkernel/intern/object.cc +++ b/source/blender/blenkernel/intern/object.cc @@ -72,7 +72,7 @@ #include "BKE_animsys.h" #include "BKE_armature.hh" #include "BKE_asset.hh" -#include "BKE_bpath.h" +#include "BKE_bpath.hh" #include "BKE_camera.h" #include "BKE_collection.h" #include "BKE_constraint.h" diff --git a/source/blender/blenkernel/intern/scene.cc b/source/blender/blenkernel/intern/scene.cc index 5529e6e6974..0ee679b0355 100644 --- a/source/blender/blenkernel/intern/scene.cc +++ b/source/blender/blenkernel/intern/scene.cc @@ -58,7 +58,7 @@ #include "BKE_anim_data.h" #include "BKE_animsys.h" #include "BKE_armature.hh" -#include "BKE_bpath.h" +#include "BKE_bpath.hh" #include "BKE_cachefile.h" #include "BKE_collection.h" #include "BKE_colortools.hh" diff --git a/source/blender/blenkernel/intern/sound.cc b/source/blender/blenkernel/intern/sound.cc index e8771016e28..583e0e42c87 100644 --- a/source/blender/blenkernel/intern/sound.cc +++ b/source/blender/blenkernel/intern/sound.cc @@ -40,7 +40,7 @@ # include #endif -#include "BKE_bpath.h" +#include "BKE_bpath.hh" #include "BKE_global.h" #include "BKE_idtype.hh" #include "BKE_lib_id.hh" diff --git a/source/blender/blenkernel/intern/text.cc b/source/blender/blenkernel/intern/text.cc index 8ebfbef2cf9..4bd6ad3ffaa 100644 --- a/source/blender/blenkernel/intern/text.cc +++ b/source/blender/blenkernel/intern/text.cc @@ -34,7 +34,7 @@ #include "DNA_text_types.h" #include "DNA_userdef_types.h" -#include "BKE_bpath.h" +#include "BKE_bpath.hh" #include "BKE_idtype.hh" #include "BKE_lib_id.hh" #include "BKE_main.hh" diff --git a/source/blender/blenkernel/intern/vfont.cc b/source/blender/blenkernel/intern/vfont.cc index fb36cddc4d9..12f6e81a18b 100644 --- a/source/blender/blenkernel/intern/vfont.cc +++ b/source/blender/blenkernel/intern/vfont.cc @@ -37,7 +37,7 @@ #include "DNA_vfont_types.h" #include "BKE_anim_path.h" -#include "BKE_bpath.h" +#include "BKE_bpath.hh" #include "BKE_curve.hh" #include "BKE_global.h" #include "BKE_idtype.hh" diff --git a/source/blender/blenkernel/intern/volume.cc b/source/blender/blenkernel/intern/volume.cc index 1221ce52498..d7ba17e96dc 100644 --- a/source/blender/blenkernel/intern/volume.cc +++ b/source/blender/blenkernel/intern/volume.cc @@ -31,7 +31,7 @@ #include "BKE_anim_data.h" #include "BKE_bake_data_block_id.hh" -#include "BKE_bpath.h" +#include "BKE_bpath.hh" #include "BKE_geometry_set.hh" #include "BKE_global.h" #include "BKE_idtype.hh" diff --git a/source/blender/blenloader/intern/writefile.cc b/source/blender/blenloader/intern/writefile.cc index 45f5f8610f2..37aa5a148a9 100644 --- a/source/blender/blenloader/intern/writefile.cc +++ b/source/blender/blenloader/intern/writefile.cc @@ -100,7 +100,7 @@ #include "MEM_guardedalloc.h" /* MEM_freeN */ #include "BKE_blender_version.h" -#include "BKE_bpath.h" +#include "BKE_bpath.hh" #include "BKE_global.h" /* For #Global `G`. */ #include "BKE_idprop.h" #include "BKE_idtype.hh" diff --git a/source/blender/editors/asset/intern/asset_ops.cc b/source/blender/editors/asset/intern/asset_ops.cc index 0e48e9d98c2..93e2701a68a 100644 --- a/source/blender/editors/asset/intern/asset_ops.cc +++ b/source/blender/editors/asset/intern/asset_ops.cc @@ -10,7 +10,7 @@ #include "AS_asset_representation.hh" #include "BKE_asset.hh" -#include "BKE_bpath.h" +#include "BKE_bpath.hh" #include "BKE_context.hh" #include "BKE_lib_id.hh" #include "BKE_main.hh" diff --git a/source/blender/editors/space_info/info_ops.cc b/source/blender/editors/space_info/info_ops.cc index da56fe1c0e1..1a60376e796 100644 --- a/source/blender/editors/space_info/info_ops.cc +++ b/source/blender/editors/space_info/info_ops.cc @@ -20,7 +20,7 @@ #include "BLT_translation.hh" -#include "BKE_bpath.h" +#include "BKE_bpath.hh" #include "BKE_context.hh" #include "BKE_global.h" #include "BKE_image.h" diff --git a/source/blender/python/intern/bpy.cc b/source/blender/python/intern/bpy.cc index aa0d505148d..8a6fdf61c0e 100644 --- a/source/blender/python/intern/bpy.cc +++ b/source/blender/python/intern/bpy.cc @@ -21,7 +21,7 @@ #include "BKE_appdir.hh" #include "BKE_blender_version.h" -#include "BKE_bpath.h" +#include "BKE_bpath.hh" #include "BKE_global.h" /* XXX, G_MAIN only */ #include "RNA_access.hh"