Merge remote-tracking branch 'origin/blender-v3.0-release'

This commit is contained in:
2021-11-30 15:36:48 +01:00
3 changed files with 39 additions and 10 deletions

View File

@@ -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;
}
/* -------------------------------------------------------------------- */

View File

@@ -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);

View File

@@ -1941,6 +1941,8 @@ int rna_property_override_diff_default(Main *bmain,
idx_a - 1);
# endif
op = NULL;
equals = false;
}
else if (is_id || is_valid_for_diffing) {
if (equals || do_create) {