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:
authorSybren A. Stüvel <sybren@blender.org>2021-11-30 17:36:48 +0300
committerSybren A. Stüvel <sybren@blender.org>2021-11-30 17:36:48 +0300
commit74039388cdff53b081197faaf7b6ffbaffe691ce (patch)
tree102de3552082c0a0b273cf5290c7c4d56b952904 /source/blender/editors
parent7863e03e89fa5d07602497a61d86961af1b10434 (diff)
parentde7f1e8e070be93daf8e1a2c7c96f94cabc34867 (diff)
Merge remote-tracking branch 'origin/blender-v3.0-release'
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/asset/intern/asset_ops.cc42
-rw-r--r--source/blender/editors/space_file/file_ops.c5
2 files changed, 37 insertions, 10 deletions
diff --git a/source/blender/editors/asset/intern/asset_ops.cc b/source/blender/editors/asset/intern/asset_ops.cc
index c7644288959..8bd8a8f73c2 100644
--- a/source/blender/editors/asset/intern/asset_ops.cc
+++ b/source/blender/editors/asset/intern/asset_ops.cc
@@ -30,6 +30,7 @@
#include "BLI_fileops.h"
#include "BLI_fnmatch.h"
#include "BLI_path_util.h"
+#include "BLI_set.hh"
#include "ED_asset.h"
#include "ED_asset_catalog.hh"
@@ -877,7 +878,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(BPathForeachPathData *bpath_data,
@@ -886,24 +887,20 @@ static bool external_file_check_callback(BPathForeachPathData *bpath_data,
{
FileCheckCallbackInfo *callback_info = static_cast<FileCheckCallbackInfo *>(
bpath_data->user_data);
- 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>()};
eBPathForeachFlag flag = static_cast<eBPathForeachFlag>(
BKE_BPATH_FOREACH_PATH_SKIP_PACKED /* Packed files are fine. */
@@ -917,9 +914,34 @@ static bool has_external_files(Main *bmain, struct ReportList *reports)
/* user_data */ &callback_info,
/* absolute_base_path */ nullptr,
};
-
BKE_bpath_foreach_path_main(&bpath_data);
- 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;
}
/* -------------------------------------------------------------------- */
diff --git a/source/blender/editors/space_file/file_ops.c b/source/blender/editors/space_file/file_ops.c
index 34fad2bcbdb..1abdaa542c2 100644
--- a/source/blender/editors/space_file/file_ops.c
+++ b/source/blender/editors/space_file/file_ops.c
@@ -211,6 +211,11 @@ static FileSelect file_select_do(bContext *C, int selected_idx, bool do_diropen)
filelist_setrecursion(sfile->files, params->recursion_level);
}
}
+ else if (file->redirection_path) {
+ BLI_strncpy(params->dir, file->redirection_path, sizeof(params->dir));
+ BLI_path_normalize_dir(BKE_main_blendfile_path(bmain), params->dir);
+ BLI_path_slash_ensure(params->dir);
+ }
else {
BLI_path_normalize_dir(BKE_main_blendfile_path(bmain), params->dir);
strcat(params->dir, file->relpath);