Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/editors/asset/intern/asset_ops.cc41
1 files changed, 32 insertions, 9 deletions
diff --git a/source/blender/editors/asset/intern/asset_ops.cc b/source/blender/editors/asset/intern/asset_ops.cc
index 5ff82fcb0c0..56d8e61e902 100644
--- a/source/blender/editors/asset/intern/asset_ops.cc
+++ b/source/blender/editors/asset/intern/asset_ops.cc
@@ -32,6 +32,7 @@
#include "BLI_fileops.h"
#include "BLI_fnmatch.h"
#include "BLI_path_util.h"
+#include "BLI_set.hh"
#include "BLI_string_ref.hh"
#include "BLI_vector.hh"
@@ -882,7 +883,7 @@ static bool set_filepath_for_asset_lib(const Main *bmain, struct wmOperator *op)
struct FileCheckCallbackInfo {
struct ReportList *reports;
- bool external_file_found;
+ Set<std::string> external_files;
};
static bool external_file_check_callback(void *callback_info_ptr,
@@ -890,24 +891,20 @@ static bool external_file_check_callback(void *callback_info_ptr,
const char *path_src)
{
FileCheckCallbackInfo *callback_info = static_cast<FileCheckCallbackInfo *>(callback_info_ptr);
- BKE_reportf(callback_info->reports,
- RPT_ERROR,
- "Unable to install asset bundle, has external dependency \"%s\"",
- path_src);
- callback_info->external_file_found = true;
+ callback_info->external_files.add(std::string(path_src));
return false;
}
/**
* Do a check on any external files (.blend, textures, etc.) being used.
- * The "Install asset bundle" operator only works on standalone .blend files
+ * The ASSET_OT_bundle_install operator only works on standalone .blend files
* (catalog definition files are fine, though).
*
* \return true when there are external files, false otherwise.
*/
static bool has_external_files(Main *bmain, struct ReportList *reports)
{
- struct FileCheckCallbackInfo callback_info = {reports, false};
+ struct FileCheckCallbackInfo callback_info = {reports, Set<std::string>()};
BKE_bpath_traverse_main(
bmain,
@@ -916,7 +913,33 @@ static bool has_external_files(Main *bmain, struct ReportList *reports)
| BKE_BPATH_TRAVERSE_SKIP_MULTIFILE /* Only report multifiles once, it's enough. */
| BKE_BPATH_TRAVERSE_SKIP_WEAK_REFERENCES /* Only care about actually used files. */,
&callback_info);
- return callback_info.external_file_found;
+
+ if (callback_info.external_files.is_empty()) {
+ /* No external dependencies. */
+ return false;
+ }
+
+ if (callback_info.external_files.size() == 1) {
+ /* Only one external dependency, report it directly. */
+ BKE_reportf(callback_info.reports,
+ RPT_ERROR,
+ "Unable to copy bundle due to external dependency: \"%s\"",
+ callback_info.external_files.begin()->c_str());
+ return true;
+ }
+
+ /* Multiple external dependencies, report the aggregate and put details on console. */
+ BKE_reportf(
+ callback_info.reports,
+ RPT_ERROR,
+ "Unable to copy bundle due to %ld external dependencies; more details on the console",
+ callback_info.external_files.size());
+ printf("Unable to copy bundle due to %ld external dependencies:\n",
+ callback_info.external_files.size());
+ for (const std::string &path : callback_info.external_files) {
+ printf(" \"%s\"\n", path.c_str());
+ }
+ return true;
}
/* -------------------------------------------------------------------- */