|
Blender V5.0
|
#include "BLI_utildefines.h"Go to the source code of this file.
Classes | |
| struct | BPathForeachPathData |
| struct | BPathSummary |
Functions | |
Helpers to handle common cases from <tt>IDTypeInfo</tt>'s <tt>foreach_path</tt> functions. | |
| bool | BKE_bpath_foreach_path_fixed_process (BPathForeachPathData *bpath_data, char *path, size_t path_maxncpy) |
| bool | BKE_bpath_foreach_path_dirfile_fixed_process (BPathForeachPathData *bpath_data, char *path_dir, size_t path_dir_maxncpy, char *path_file, size_t path_file_maxncpy) |
| bool | BKE_bpath_foreach_path_allocated_process (BPathForeachPathData *bpath_data, char **path) |
High level features. | |
| void | BKE_bpath_missing_files_check (Main *bmain, ReportList *reports) |
| void | BKE_bpath_summary_report (const BPathSummary &summary, ReportList *reports) |
| void | BKE_bpath_missing_files_find (Main *bmain, const char *searchpath, ReportList *reports, bool find_all) |
| void | BKE_bpath_relative_rebase (Main *bmain, const char *basedir_src, const char *basedir_dst, ReportList *reports, BPathSummary *r_summary=nullptr) |
| void | BKE_bpath_relative_convert (Main *bmain, const char *basedir, ReportList *reports, BPathSummary *r_summary=nullptr) |
| void | BKE_bpath_absolute_convert (Main *bmain, const char *basedir, ReportList *reports, BPathSummary *r_summary=nullptr) |
| void * | BKE_bpath_list_backup (Main *bmain, eBPathForeachFlag flag) |
| void | BKE_bpath_list_restore (Main *bmain, eBPathForeachFlag flag, void *path_list_handle) |
| void | BKE_bpath_list_free (void *path_list_handle) |
Core <tt>foreach_path</tt> API. | |
| enum | eBPathForeachFlag { BKE_BPATH_FOREACH_PATH_ABSOLUTE = (1 << 0) , BKE_BPATH_FOREACH_PATH_SKIP_LINKED = (1 << 1) , BKE_BPATH_FOREACH_PATH_SKIP_PACKED = (1 << 2) , BKE_BPATH_FOREACH_PATH_RESOLVE_TOKEN = (1 << 3) , BKE_BPATH_TRAVERSE_SKIP_WEAK_REFERENCES = (1 << 5) , BKE_BPATH_FOREACH_PATH_SKIP_MULTIFILE = (1 << 8) , BKE_BPATH_FOREACH_PATH_RELOAD_EDITED = (1 << 9) } |
| using | BPathForeachPathFunctionCallback |
| void | BKE_bpath_foreach_path_id (BPathForeachPathData *bpath_data, ID *id) |
| void | BKE_bpath_foreach_path_main (BPathForeachPathData *bpath_data) |
Definition in file BKE_bpath.hh.
Callback used to iterate over an ID's file paths.
| path_dst | Optionally write to the path (for callbacks that manipulate the path). |
| path_dst_maxncpy | The buffer size of path_dst including the null byte. |
Definition at line 92 of file BKE_bpath.hh.
| enum eBPathForeachFlag |
Flags controlling the behavior of the generic BPath API.
Note: these are referred to by rna_enum_file_path_foreach_flag_items, so make sure that any new enum items are added there too.
| Enumerator | |
|---|---|
| BKE_BPATH_FOREACH_PATH_ABSOLUTE | Ensures the absolute_base_path member of BPathForeachPathData is initialized properly with the path of the current .blend file. This can be used by the callbacks to convert relative paths to absolute ones. |
| BKE_BPATH_FOREACH_PATH_SKIP_LINKED | Skip paths of linked IDs. |
| BKE_BPATH_FOREACH_PATH_SKIP_PACKED | Skip paths when their matching data is packed. |
| BKE_BPATH_FOREACH_PATH_RESOLVE_TOKEN | Resolve tokens within a virtual filepath to a single, concrete, filepath. Currently only used for UDIM tiles. |
| BKE_BPATH_TRAVERSE_SKIP_WEAK_REFERENCES | Skip weak reference paths. Those paths are typically 'nice to have' extra information, but are not used as actual source of data by the current .blend file. NOTE: Currently this only concerns the weak reference to a library file stored in ID::library_weak_reference. |
| BKE_BPATH_FOREACH_PATH_SKIP_MULTIFILE | Flags not affecting the generic BPath API. Those may be used by specific IDTypeInfo foreach_path implementations and/or callbacks to implement specific behaviors. Skip paths where a single dir is used with an array of files, eg. sequence strip images or point-caches. In this case only the first file path is processed. This is needed for directory manipulation callbacks which might otherwise modify the same directory multiple times. |
| BKE_BPATH_FOREACH_PATH_RELOAD_EDITED | Reload data (when the path is edited).
|
Definition at line 32 of file BKE_bpath.hh.
| void BKE_bpath_absolute_convert | ( | Main * | bmain, |
| const char * | basedir, | ||
| ReportList * | reports, | ||
| BPathSummary * | r_summary = nullptr ) |
Make all relative file paths in given bmain absolute, using given basedir as root.
Definition at line 627 of file bpath.cc.
References absolute_convert_foreach_path_cb(), and bpath_absolute_relative_convert().
Referenced by BKE_main_merge(), BLO_write_file_impl(), make_paths_absolute_exec(), and blender::bke::tests::TEST_F().
| bool BKE_bpath_foreach_path_allocated_process | ( | BPathForeachPathData * | bpath_data, |
| char ** | path ) |
Run the callback on a path, replacing the content of the string as needed.
| path | A pointer to a MEM-allocated string. If modified, it will be freed and replaced by a new allocated string. |
Definition at line 187 of file bpath.cc.
References BPathForeachPathData::absolute_base_path, BLI_path_abs(), BLI_strdup(), BPathForeachPathData::callback_function, FILE_MAX, BPathForeachPathData::is_path_modified, MEM_freeN(), and STRNCPY().
Referenced by text_foreach_path().
| bool BKE_bpath_foreach_path_dirfile_fixed_process | ( | BPathForeachPathData * | bpath_data, |
| char * | path_dir, | ||
| size_t | path_dir_maxncpy, | ||
| char * | path_file, | ||
| size_t | path_file_maxncpy ) |
Run the callback on a (directory + file) path, replacing the content of the two strings as needed.
| path_dir | A fixed, FILE_MAXDIR-sized char buffer. |
| path_file | A fixed, FILE_MAXFILE-sized char buffer. |
Definition at line 156 of file bpath.cc.
References BPathForeachPathData::absolute_base_path, BLI_path_abs(), BLI_path_join, BLI_path_split_dir_file(), BPathForeachPathData::callback_function, FILE_MAX, BPathForeachPathData::is_path_modified, and STRNCPY().
Referenced by strip_foreach_path_callback().
| bool BKE_bpath_foreach_path_fixed_process | ( | BPathForeachPathData * | bpath_data, |
| char * | path, | ||
| size_t | path_maxncpy ) |
Run the callback on a path, replacing the content of the string as needed.
| path | A fixed, FILE_MAX-sized char buffer. |
Definition at line 125 of file bpath.cc.
References BPathForeachPathData::absolute_base_path, BLI_path_abs(), BLI_strncpy(), BPathForeachPathData::callback_function, FILE_MAX, BPathForeachPathData::is_path_modified, and STRNCPY().
Referenced by BKE_bpath_foreach_path_id(), cache_file_foreach_path(), camera_foreach_path(), image_foreach_path(), library_foreach_path(), mesh_foreach_path(), movie_clip_foreach_path(), blender::bke::node_foreach_path(), object_foreach_path(), object_foreach_path_pointcache(), sound_foreach_path(), strip_foreach_path_callback(), vfont_foreach_path(), and volume_foreach_path().
| void BKE_bpath_foreach_path_id | ( | BPathForeachPathData * | bpath_data, |
| ID * | id ) |
Run bpath_data.callback_function on all paths contained in id.
Definition at line 75 of file bpath.cc.
References BPathForeachPathData::absolute_base_path, BKE_BPATH_FOREACH_PATH_ABSOLUTE, BKE_bpath_foreach_path_fixed_process(), BKE_bpath_foreach_path_id(), BKE_BPATH_FOREACH_PATH_SKIP_LINKED, BKE_BPATH_TRAVERSE_SKIP_WEAK_REFERENCES, BKE_idtype_get_info_from_id(), BLI_assert, BPathForeachPathData::bmain, DEG_id_tag_update(), BPathForeachPathData::flag, flag, IDTypeInfo::foreach_path, bNodeTree::id, ID_BLEND_PATH, ID_IS_LINKED, ID_RECALC_SOURCE, ID_RECALC_SYNC_TO_EVAL, BPathForeachPathData::is_path_modified, LibraryWeakReference::library_filepath, ID::library_weak_reference, blender::bke::node_tree_from_id(), and BPathForeachPathData::owner_id.
Referenced by BKE_bpath_foreach_path_id(), BKE_bpath_foreach_path_main(), bpy_file_path_foreach(), and foreach_id_file_path_map().
| void BKE_bpath_foreach_path_main | ( | BPathForeachPathData * | bpath_data | ) |
Run bpath_data.callback_function on all paths of all IDs in bmain.
Definition at line 116 of file bpath.cc.
References BKE_bpath_foreach_path_id(), BPathForeachPathData::bmain, FOREACH_MAIN_ID_BEGIN, and FOREACH_MAIN_ID_END.
Referenced by BKE_bpath_list_backup(), BKE_bpath_list_restore(), BKE_bpath_missing_files_check(), BKE_bpath_missing_files_find(), BKE_bpath_relative_rebase(), bpath_absolute_relative_convert(), bpy_blend_paths(), clean_paths(), and blender::ed::asset::has_external_files().
| void * BKE_bpath_list_backup | ( | Main * | bmain, |
| eBPathForeachFlag | flag ) |
Temp backup of paths from all IDs in given bmain.
Definition at line 692 of file bpath.cc.
References BKE_bpath_foreach_path_main(), BPathForeachPathData::bmain, bpath_list_append(), BPathForeachPathData::callback_function, BPathForeachPathData::flag, flag, MEM_callocN(), and BPathForeachPathData::user_data.
Referenced by BLO_write_file_impl(), and blender::bke::tests::TEST_F().
| void BKE_bpath_list_free | ( | void * | path_list_handle | ) |
Free the temp backup of paths in path_list_handle.
Definition at line 718 of file bpath.cc.
References BLI_assert, BLI_freelistN(), BLI_listbase_is_empty(), and MEM_freeN().
Referenced by BLO_write_file_impl(), and blender::bke::tests::TEST_F().
| void BKE_bpath_list_restore | ( | Main * | bmain, |
| eBPathForeachFlag | flag, | ||
| void * | path_list_handle ) |
Restore the temp backup of paths from path_list_handle into all IDs in given bmain.
Definition at line 706 of file bpath.cc.
References BKE_bpath_foreach_path_main(), BPathForeachPathData::bmain, bpath_list_restore(), BPathForeachPathData::callback_function, BPathForeachPathData::flag, flag, and BPathForeachPathData::user_data.
Referenced by BLO_write_file_impl(), and blender::bke::tests::TEST_F().
| void BKE_bpath_missing_files_check | ( | Main * | bmain, |
| ReportList * | reports ) |
Check for missing files.
Definition at line 255 of file bpath.cc.
References BKE_BPATH_FOREACH_PATH_ABSOLUTE, BKE_bpath_foreach_path_main(), BKE_BPATH_FOREACH_PATH_RESOLVE_TOKEN, BKE_BPATH_FOREACH_PATH_SKIP_PACKED, BKE_BPATH_TRAVERSE_SKIP_WEAK_REFERENCES, BKE_reportf(), BLI_listbase_is_empty(), BPathForeachPathData::bmain, BPathForeachPathData::callback_function, check_missing_files_foreach_path_cb(), BPathForeachPathData::flag, ReportList::list, RPT_INFO, and BPathForeachPathData::user_data.
Referenced by report_missing_files_exec().
| void BKE_bpath_missing_files_find | ( | Main * | bmain, |
| const char * | searchpath, | ||
| ReportList * | reports, | ||
| bool | find_all ) |
Recursively search into given search directory, for all file paths of all IDs in given bmain, and replace existing paths as needed.
| searchpath | The root directory in which the new filepaths should be searched for. |
| find_all | If true, also search for files which current path is still valid, if false skip those still valid paths. |
Definition at line 407 of file bpath.cc.
References BKE_BPATH_FOREACH_PATH_ABSOLUTE, BKE_bpath_foreach_path_main(), BKE_BPATH_FOREACH_PATH_RELOAD_EDITED, BKE_BPATH_FOREACH_PATH_RESOLVE_TOKEN, BKE_BPATH_TRAVERSE_SKIP_WEAK_REFERENCES, BKE_main_blendfile_path(), BPathForeachPathData::bmain, BPathForeachPathData::callback_function, data, BPathForeachPathData::flag, flag, missing_files_find_foreach_path_cb(), and BPathForeachPathData::user_data.
Referenced by find_missing_files_exec().
| void BKE_bpath_relative_convert | ( | Main * | bmain, |
| const char * | basedir, | ||
| ReportList * | reports, | ||
| BPathSummary * | r_summary = nullptr ) |
Make all absolute file paths in given bmain relative to given basedir.
Definition at line 618 of file bpath.cc.
References bpath_absolute_relative_convert(), and relative_convert_foreach_path_cb().
Referenced by BLO_write_file_impl(), make_paths_relative_exec(), and blender::bke::tests::TEST_F().
| void BKE_bpath_relative_rebase | ( | Main * | bmain, |
| const char * | basedir_src, | ||
| const char * | basedir_dst, | ||
| ReportList * | reports, | ||
| BPathSummary * | r_summary = nullptr ) |
Rebase all relative file paths in given bmain from basedir_src to basedir_dst.
Definition at line 478 of file bpath.cc.
References BKE_bpath_foreach_path_main(), BKE_BPATH_FOREACH_PATH_SKIP_LINKED, BKE_BPATH_FOREACH_PATH_SKIP_MULTIFILE, BLI_assert, BPathForeachPathData::bmain, BPathForeachPathData::callback_function, data, BPathForeachPathData::flag, flag, relative_rebase_foreach_path_cb(), and BPathForeachPathData::user_data.
Referenced by BKE_main_merge(), BLO_write_file_impl(), blender::bke::tests::TEST_F(), and blender::bke::tests::TEST_F().
| void BKE_bpath_summary_report | ( | const BPathSummary & | summary, |
| ReportList * | reports ) |
Definition at line 59 of file bpath.cc.
References BKE_reportf(), BPathSummary::count_changed, BPathSummary::count_failed, BPathSummary::count_total, RPT_INFO, and RPT_WARNING.
Referenced by make_paths_absolute_exec(), and make_paths_relative_exec().