Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/bpath.c
| Show First 20 Lines • Show All 198 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Check Missing Files | /** \name Check Missing Files | ||||
| * \{ */ | * \{ */ | ||||
| struct MissingFilesContext { | |||||
| ReportList* reports; | |||||
| bool has_missing_files; | |||||
| }; | |||||
| static bool check_missing_files_foreach_path_cb(BPathForeachPathData *bpath_data, | static bool check_missing_files_foreach_path_cb(BPathForeachPathData *bpath_data, | ||||
| char *UNUSED(path_dst), | char *UNUSED(path_dst), | ||||
| const char *path_src) | const char *path_src) | ||||
| { | { | ||||
| ReportList *reports = (ReportList *)bpath_data->user_data; | struct MissingFilesContext* context = (struct MissingFilesContext *)bpath_data->user_data; | ||||
| if (!BLI_exists(path_src)) { | if (!BLI_exists(path_src)) { | ||||
| BKE_reportf(reports, RPT_WARNING, "Path '%s' not found", path_src); | BKE_reportf(context->reports, RPT_WARNING, "Path '%s' not found", path_src); | ||||
| context->has_missing_files = true; | |||||
| } | } | ||||
| return false; | return false; | ||||
| } | } | ||||
| void BKE_bpath_missing_files_check(Main *bmain, ReportList *reports) | void BKE_bpath_missing_files_check(Main *bmain, ReportList *reports) | ||||
| { | { | ||||
| struct MissingFilesContext context = { | |||||
| .reports = reports, | |||||
| .has_missing_files = false, | |||||
| }; | |||||
| BKE_bpath_foreach_path_main(&(BPathForeachPathData){ | BKE_bpath_foreach_path_main(&(BPathForeachPathData){ | ||||
| .bmain = bmain, | .bmain = bmain, | ||||
| .callback_function = check_missing_files_foreach_path_cb, | .callback_function = check_missing_files_foreach_path_cb, | ||||
| .flag = BKE_BPATH_FOREACH_PATH_ABSOLUTE | BKE_BPATH_FOREACH_PATH_SKIP_PACKED | | .flag = BKE_BPATH_FOREACH_PATH_ABSOLUTE | BKE_BPATH_FOREACH_PATH_SKIP_PACKED | | ||||
| BKE_BPATH_FOREACH_PATH_RESOLVE_TOKEN | BKE_BPATH_TRAVERSE_SKIP_WEAK_REFERENCES, | BKE_BPATH_FOREACH_PATH_RESOLVE_TOKEN | BKE_BPATH_TRAVERSE_SKIP_WEAK_REFERENCES, | ||||
| .user_data = reports}); | .user_data = &context | ||||
| }); | |||||
| if (context.has_missing_files == false) { | |||||
| BKE_reportf(reports, RPT_INFO, "No missing files"); | |||||
| } | |||||
| } | } | ||||
| /** \} */ | /** \} */ | ||||
| /* -------------------------------------------------------------------- */ | /* -------------------------------------------------------------------- */ | ||||
| /** \name Find Missing Files | /** \name Find Missing Files | ||||
| * \{ */ | * \{ */ | ||||
| ▲ Show 20 Lines • Show All 417 Lines • Show Last 20 Lines | |||||