111 const bool do_change)
126 const bool do_change)
135 if (do_change && !is_valid) {
153 ListBaseT<FileListInternEntry> *from_entries,
154 int from_entries_num)
156 BLI_assert(from_entries->count() == from_entries_num);
157 if (from_entries_num <= 0) {
162 std::scoped_lock
lock(job_params->
lock);
170static int filelist_add_userfonts_regpath(HKEY hKeyParent,
172 ListBaseT<FileListInternEntry> *entries)
177 if (RegOpenKeyExA(hKeyParent, subkeyName, 0, KEY_ALL_ACCESS, &key) != ERROR_SUCCESS) {
184 DWORD KeyNameLen =
sizeof(KeyName);
186 DWORD KeyValueLen =
sizeof(KeyValue);
190 while (RegEnumValueA(key,
197 &KeyValueLen) == ERROR_SUCCESS)
200 if (valueType == REG_SZ || valueType == REG_EXPAND_SZ) {
203 const char *val_str = (
const char *)KeyValue;
205 const size_t lslash = lslash_str ? size_t(lslash_str - val_str) + 1 : 0;
208 entry->relpath =
BLI_strdup(val_str + lslash);
210 entry->free_name =
true;
213 entry->redirection_path =
BLI_strdup(val_str);
218 KeyNameLen =
sizeof(KeyName);
219 KeyValueLen =
sizeof(KeyValue);
225 while (RegEnumKeyExA(key,
index, (LPSTR)&KeyName, &KeyNameLen, NULL, NULL, NULL, NULL) ==
228 font_num += filelist_add_userfonts_regpath(key, KeyName, entries);
229 KeyNameLen =
sizeof(KeyName);
237static int filelist_add_userfonts(ListBaseT<FileListInternEntry> *entries)
239 return filelist_add_userfonts_regpath(
240 HKEY_CURRENT_USER,
"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts", entries);
247 ListBaseT<FileListInternEntry> *entries,
248 const char *filter_glob,
250 const char *main_filepath,
251 const bool skip_currpar)
262 if (
STREQ(root, fonts_path)) {
263 entries_num += filelist_add_userfonts(entries);
277 entry = MEM_new<FileListInternEntry>(__func__);
279 entry->
st = files[i].
s;
282 char *target = full_path;
286 if (
S_ISDIR(files[i].s.st_mode)
388 const FileListReadJob *job_params,
const int idcode,
const char *group_name)
399 ListBaseT<FileListInternEntry> *entries,
401 const bool prefix_relpath_with_group_name,
403 const char *group_name,
404 const std::optional<asset_system::OnlineAssetInfo> online_asset_info)
407 if (prefix_relpath_with_group_name) {
415 if (datablock_info) {
418 if (datablock_info->
name[0] ==
'.') {
425 if (online_asset_info) {
436 std::unique_ptr
metadata = std::make_unique<AssetMetaData>(
444 entry->
asset = online_asset_info ?
447 datablock_info->
name,
450 *online_asset_info) :
464 ListBaseT<FileListInternEntry> *entries,
466 const bool prefix_relpath_with_group_name,
468 const char *group_name)
470 for (
LinkNode *ln = datablock_infos; ln; ln = ln->
next) {
473 job_params, entries, datablock_info, prefix_relpath_with_group_name, idcode, group_name);
488 ListBaseT<FileListInternEntry> *entries,
490 const bool prefix_relpath_with_group_name)
498 prefix_relpath_with_group_name,
505 ListBaseT<FileListInternEntry> *entries,
507 const int read_from_index,
510 int navigate_to_parent_len = 0;
515 navigate_to_parent_len = 1;
519 return read_from_index + navigate_to_parent_len;
528 ListBaseT<FileListInternEntry> *entries,
536 BlendHandle *libfiledata =
nullptr;
549 const bool has_group = group !=
nullptr;
559 const bool use_indexer = !has_group;
562 int read_from_index = 0;
564 dir, &indexer_entries, &read_from_index, indexer_runtime->
user_data);
567 job_params, entries,
options, read_from_index, &indexer_entries);
576 if (libfiledata ==
nullptr) {
584 int navigate_to_parent_len = 0;
589 navigate_to_parent_len = 1;
593 int datablock_len = 0;
600 job_params, entries, datablock_infos,
false, idcode, group);
609 const char *group_name =
static_cast<char *
>(ln->link);
612 job_params, idcode, group_name);
616 int group_datablock_len;
620 job_params, entries, group_datablock_infos,
true, idcode, group_name);
623 &indexer_entries, group_datablock_infos, idcode);
626 datablock_len += group_datablock_len;
642 int added_entries_len = group_len + datablock_len + navigate_to_parent_len;
643 return added_entries_len;
648 const int current_recursion_level,
651 if (max_recursion == 0) {
655 if (!is_lib && current_recursion_level > max_recursion) {
661 if (!is_lib && (current_recursion_level >= max_recursion) &&
690 ListBaseT<FileListInternEntry> entries = {
nullptr};
697 int dirs_done_count = 0, dirs_todo_count = 1;
730 subdir = td_dir->
dir;
731 recursion_level = td_dir->
level;
732 skip_currpar = (recursion_level > 1);
758 if (max_recursion > 0) {
767 job_params, subdir, &entries, list_lib_options, &indexer_runtime);
768 if (lib_entries_num) {
770 entries_num += *lib_entries_num;
789 entry.free_name =
true;
792 max_recursion, is_lib, recursion_level, &entry))
800 td_dir->
level = recursion_level + 1;
811 *progress =
float(dirs_done_count) /
float(dirs_todo_count);
828 MEM_delete(td_dir->
dir);
#define BLI_path_join(...)
#define FILENAME_IS_CURRPAR(_n)
#define BLI_string_join(...)
Compatibility-like things for windows.
#define FILE_MAX_LIBEXTRA
#define ARRAY_SET_ITEMS(...)
#define BLI_assert_msg(a, msg)
eAssetLibraryType library_type() const
std::weak_ptr< AssetRepresentation > add_external_on_disk_asset(StringRef relative_asset_path, StringRef name, int id_type, std::unique_ptr< AssetMetaData > metadata)
std::weak_ptr< AssetRepresentation > add_external_online_asset(StringRef relative_asset_path, StringRef name, int id_type, std::unique_ptr< AssetMetaData > metadata, OnlineAssetInfo online_info)
CCL_NAMESPACE_BEGIN struct Options options
#define FILEDIR_NBR_ENTRIES_UNSET
ENUM_OPERATORS(Layer::Flags)
std::string filename(const std::string_view &str, size_t pos)
bool bool BLI_path_extension_strip(char *path) ATTR_NONNULL(1)
const char * BKE_idtype_idcode_to_name(short idcode)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
BlendHandle * BLO_blendhandle_from_file(const char *filepath, BlendFileReadReport *reports)
LinkNode * BLO_blendhandle_get_datablock_info(BlendHandle *bh, int ofblocktype, bool use_assets_only, int *r_tot_info_items)
void BLO_datablock_info_linklist_free(LinkNode *datablock_infos)
char * STRNCPY(char(&dst)[N], const char *src)
bool BLI_stack_is_empty(const BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
bool BLI_path_abs(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1
unsigned int BLI_filelist_dir_contents(const char *dirname, struct direntry **r_filelist)
void BLI_stack_free(BLI_Stack *stack) ATTR_NONNULL()
int ED_path_extension_type(const char *path)
bool BKE_blendfile_library_path_explode(const char *path, char *r_dir, char **r_group, char **r_name)
void BLO_blendhandle_close(BlendHandle *bh) ATTR_NONNULL(1)
int BLI_path_normalize_dir(char *dir, size_t dir_maxncpy) ATTR_NONNULL(1)
static std::optional< int > filelist_readjob_list_lib(FileListReadJob *job_params, const char *root, ListBaseT< FileListInternEntry > *entries, const ListLibOptions options, FileIndexer *indexer_runtime)
void ED_file_indexer_entries_clear(FileIndexerEntries *indexer_entries)
bool filelist_checkdir_dir(const FileList *, char dirpath[FILE_MAX_LIBEXTRA], const bool do_change)
void void void BLI_movelisttolist(ListBase *dst, ListBase *src) ATTR_NONNULL(1
void BLI_stack_discard(BLI_Stack *stack) ATTR_NONNULL()
eFileAttributes BLI_file_attributes(const char *path)
void * BLI_stack_push_r(BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
char * current_relpath_append(const FileListReadJob *job_params, const char *filename)
static void parent_dir_until_exists_or_default_root(char *dir)
bool filelist_checkdir_return_always_valid(const FileList *, char[1024+258], const bool)
void BLI_linklist_freeN(LinkNode *list)
void filelist_entry_glob_tag(FileListInternEntry *entry, const char *filter_glob)
static void filelist_readjob_list_lib_add_datablocks(FileListReadJob *job_params, ListBaseT< FileListInternEntry > *entries, LinkNode *datablock_infos, const bool prefix_relpath_with_group_name, const int idcode, const char *group_name)
int BLI_stat(const char *path, BLI_stat_t *buffer) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
void ED_file_indexer_entries_extend_from_datablock_infos(FileIndexerEntries *indexer_entries, LinkNode *datablock_infos, int idcode)
bool BLI_path_is_abs_from_cwd(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
bool filelist_checkdir_lib(const FileList *, char dirpath[FILE_MAX_LIBEXTRA], const bool do_change)
void filelist_readjob_load_asset_library_data(FileListReadJob *job_params, bool *do_update)
bool void BLI_path_rel(char path[FILE_MAX], const char *basepath) ATTR_NONNULL(1)
const char * fileentry_uiname(const char *root, FileListInternEntry *entry, char *buff)
asset_system::AssetLibrary * AS_asset_library_load(const Main *bmain, const AssetLibraryReference &library_reference)
static bool filelist_readjob_should_recurse_into_entry(const int max_recursion, const bool is_lib, const int current_recursion_level, FileListInternEntry *entry)
void * BLI_stack_peek(BLI_Stack *stack) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
int BLI_path_slash_ensure(char *path, size_t path_maxncpy) ATTR_NONNULL(1)
void filelist_readjob_list_lib_add_datablock(FileListReadJob *job_params, ListBaseT< FileListInternEntry > *entries, BLODataBlockInfo *datablock_info, const bool prefix_relpath_with_group_name, const int idcode, const char *group_name, const std::optional< asset_system::OnlineAssetInfo > online_asset_info=std::nullopt)
static FileListInternEntry * filelist_readjob_list_lib_navigate_to_parent_entry_create(const FileListReadJob *job_params)
bool BLI_is_dir(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
static int filelist_readjob_list_dir(FileListReadJob *job_params, const char *root, ListBaseT< FileListInternEntry > *entries, const char *filter_glob, const bool do_lib, const char *main_filepath, const bool skip_currpar)
static void filelist_readjob_list_lib_add_from_indexer_entries(FileListReadJob *job_params, ListBaseT< FileListInternEntry > *entries, const FileIndexerEntries *indexer_entries, const bool prefix_relpath_with_group_name)
static int groupname_to_code(const char *group)
@ FILE_INDEXER_ENTRIES_LOADED
void BLI_filelist_free(struct direntry *filelist, unsigned int nrentries)
FileUID filelist_uid_generate(FileList *filelist)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
char * BLF_display_name_from_file(const char *filepath) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
bool BLI_path_is_rel(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
LinkNode * BLO_blendhandle_get_linkable_groups(BlendHandle *bh)
bool BKE_appdir_font_folder_default(char *dir, size_t dir_maxncpy)
@ FILE_TYPE_BLENDER_BACKUP
bool BKE_blendfile_extension_check(const char *str)
void filelist_readjob_recursive_dir_add_items(const bool do_lib, FileListReadJob *job_params, const bool *stop, bool *do_update, float *progress)
bool BLI_path_has_hidden_component(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
short BKE_idtype_idcode_from_name(const char *idtype_name)
int BLI_linklist_count(const LinkNode *list) ATTR_WARN_UNUSED_RESULT
bool BLI_file_alias_target(const char *filepath, char r_targetpath[768]) ATTR_WARN_UNUSED_RESULT
void filelist_readjob_directories_and_libraries(const bool do_lib, FileListReadJob *job_params, const bool *stop, bool *do_update, float *progress)
bool BLI_path_parent_dir_until_exists(char *path) ATTR_NONNULL(1)
BLI_Stack * BLI_stack_new(size_t elem_size, const char *description) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
bool BLI_is_file(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
const char * BLI_path_slash_rfind(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
bool filelist_readjob_append_entries(FileListReadJob *job_params, ListBaseT< FileListInternEntry > *from_entries, int from_entries_num)
static int filelist_readjob_list_lib_populate_from_index(FileListReadJob *job_params, ListBaseT< FileListInternEntry > *entries, const ListLibOptions options, const int read_from_index, const FileIndexerEntries *indexer_entries)
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
static FileListInternEntry * filelist_readjob_list_lib_group_create(const FileListReadJob *job_params, const int idcode, const char *group_name)
void BLI_windows_get_default_root_dir(char root_dir[4])
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
AssetMetaData * asset_data
ListBaseT< struct FileListInternEntry > entries
BLODataBlockInfo datablock_info
FileIndexerReadIndexFunc read_index
FileIndexerFinishedFunc filelist_finished
FileIndexerUpdateIndexFunc update_index
FileIndexerFreeUserDataFunc free_user_data
FileIndexerInitUserDataFunc init_user_data
const FileIndexerType * callbacks
eFileSel_File_Types typeflag
std::weak_ptr< asset_system::AssetRepresentation > asset
bool blenderlib_has_no_preview
asset_system::AssetRepresentation * get_asset() const
eFileAttributes attributes
char cur_relbase[1024+258]
std::atomic< bool > reload_asset_library
asset_system::AssetLibrary * load_asset_library
std::optional< std::function< void(asset_system::AssetRepresentation &)> > on_asset_added
AssetLibraryReference * asset_library_ref
const FileIndexerType * indexer
char filter_glob[FILE_MAXFILE]
asset_system::AssetLibrary * asset_library