Fix T91823: Regression not showing idblocks when recursion is set to `Blend file`

Introduced by fc7beac8d6. During code review it wasn't clear why this
branch was needed, so we removed it. Now it is clear why it is needed
so we added it back and added a comment why the branch is needed.

Patch provided by @Severin.
This commit is contained in:
Julian Eisel 2021-10-04 15:21:25 +02:00 committed by Jeroen Bakker
parent f806bd8261
commit cc636db8f2
Notes: blender-bot 2023-02-14 07:39:44 +01:00
Referenced by issue #91823, File Browser "Blend File" recursion level broken (regression)
1 changed files with 10 additions and 2 deletions

View File

@ -3295,6 +3295,7 @@ typedef struct FileListReadJob {
} FileListReadJob;
static bool filelist_readjob_should_recurse_into_entry(const int max_recursion,
const bool is_lib,
const int current_recursion_level,
FileListInternEntry *entry)
{
@ -3302,10 +3303,16 @@ static bool filelist_readjob_should_recurse_into_entry(const int max_recursion,
/* Recursive loading is disabled. */
return false;
}
if (current_recursion_level >= max_recursion) {
if (!is_lib && current_recursion_level > max_recursion) {
/* No more levels of recursion left. */
return false;
}
/* Show entries when recursion is set to `Blend file` even when `current_recursion_level` exceeds
* `max_recursion`. */
if (!is_lib && (current_recursion_level >= max_recursion) &&
((entry->typeflag & (FILE_TYPE_BLENDER | FILE_TYPE_BLENDER_BACKUP)) == 0)) {
return false;
}
if (entry->typeflag & FILE_TYPE_BLENDERLIB) {
/* Libraries are already loaded recursively when recursive loaded is used. No need to add
* them another time. This loading is done with the `LIST_LIB_RECURSIVE` option. */
@ -3421,7 +3428,8 @@ static void filelist_readjob_do(const bool do_lib,
entry->name = fileentry_uiname(root, entry->relpath, entry->typeflag, dir);
entry->free_name = true;
if (filelist_readjob_should_recurse_into_entry(max_recursion, recursion_level, entry)) {
if (filelist_readjob_should_recurse_into_entry(
max_recursion, is_lib, recursion_level, entry)) {
/* We have a directory we want to list, add it to todo list! */
BLI_join_dirfile(dir, sizeof(dir), root, entry->relpath);
BLI_path_normalize_dir(job_params->main_name, dir);