Blender V5.0
filelist.hh File Reference
#include <cstddef>
#include <cstdint>
#include "DNA_space_types.h"

Go to the source code of this file.

Namespaces

namespace  blender
namespace  blender::asset_system

Typedefs

using FileUID = uint32_t

Enumerations

enum  FileSelType { FILE_SEL_REMOVE = 0 , FILE_SEL_ADD = 1 , FILE_SEL_TOGGLE = 2 }
enum  FileCheckType { CHECK_DIRS = 1 , CHECK_FILES = 2 , CHECK_ALL = 3 }

Functions

void filelist_setsorting (FileList *filelist, short sort, bool invert_sort)
void filelist_sort (FileList *filelist)
void filelist_setfilter_options (FileList *filelist, bool do_filter, bool hide_dot, bool hide_parent, uint64_t filter, uint64_t filter_id, bool filter_assets_only, const char *filter_glob, const char *filter_search)
void filelist_setindexer (FileList *filelist, const FileIndexerType *indexer)
void filelist_set_asset_catalog_filter_options (FileList *filelist, eFileSel_Params_AssetCatalogVisibility catalog_visibility, const bUUID *catalog_id)
bool filelist_needs_filtering (FileList *filelist)
void filelist_tag_needs_filtering (FileList *filelist)
void filelist_filter (FileList *filelist)
void filelist_setlibrary (FileList *filelist, const AssetLibraryReference *asset_library_ref)
void filelist_init_icons ()
void filelist_free_icons ()
void filelist_file_get_full_path (const FileList *filelist, const FileDirEntry *file, char r_filepath[1282])
bool filelist_file_is_preview_pending (const FileList *filelist, const FileDirEntry *file)
ImBuffilelist_get_preview_image (FileList *filelist, int index)
ImBuffilelist_file_get_preview_image (const FileDirEntry *file)
ImBuffilelist_geticon_special_file_image_ex (const FileDirEntry *file)
ImBuffilelist_geticon_special_file_image (FileList *filelist, int index)
int filelist_geticon_file_type (FileList *filelist, int index, bool is_main)
FileListfilelist_new (short type)
void filelist_settype (FileList *filelist, short type)
void filelist_clear (FileList *filelist)
void filelist_clear_ex (FileList *filelist, bool do_asset_library, bool do_cache, bool do_selection)
void filelist_clear_from_reset_tag (FileList *filelist)
void filelist_free (FileList *filelist)
const char * filelist_dir (const FileList *filelist)
bool filelist_is_dir (const FileList *filelist, const char *path)
void filelist_setdir (FileList *filelist, char dirpath[1282])
int filelist_files_ensure (FileList *filelist)
int filelist_needs_reading (const FileList *filelist)
FileDirEntryfilelist_file (FileList *filelist, int index)
FileDirEntryfilelist_file_ex (FileList *filelist, int index, bool use_request)
int filelist_file_find_path (FileList *filelist, const char *filename)
int filelist_file_find_id (const FileList *filelist, const ID *id)
IDfilelist_file_get_id (const FileDirEntry *file)
IDfilelist_entry_get_id (const FileList *filelist, int index)
blender::asset_system::AssetRepresentationfilelist_entry_get_asset_representation (const FileList *filelist, const int index)
const char * filelist_entry_get_relpath (const FileList *filelist, int index)
bool filelist_uid_is_set (const FileUID uid)
void filelist_uid_unset (FileUID *r_uid)
void filelist_file_cache_slidingwindow_set (FileList *filelist, size_t window_size)
bool filelist_file_cache_block (FileList *filelist, int index)
bool filelist_needs_force_reset (const FileList *filelist)
void filelist_tag_force_reset (FileList *filelist)
void filelist_tag_force_reset_mainfiles (FileList *filelist)
void filelist_tag_reload_asset_library (FileList *filelist)
bool filelist_pending (const FileList *filelist)
bool filelist_needs_reset_on_main_changes (const FileList *filelist)
bool filelist_is_ready (const FileList *filelist)
unsigned int filelist_entry_select_set (const FileList *filelist, const FileDirEntry *entry, FileSelType select, const eDirEntry_SelectFlag flag, FileCheckType check)
void filelist_entry_select_index_set (FileList *filelist, int index, FileSelType select, eDirEntry_SelectFlag flag, FileCheckType check)
void filelist_entries_select_index_range_set (FileList *filelist, FileSelection *sel, FileSelType select, eDirEntry_SelectFlag flag, FileCheckType check)
eDirEntry_SelectFlag filelist_entry_select_get (FileList *filelist, FileDirEntry *entry, FileCheckType check)
eDirEntry_SelectFlag filelist_entry_select_index_get (FileList *filelist, int index, FileCheckType check)
bool filelist_entry_is_selected (FileList *filelist, int index)
void filelist_entry_parent_select_set (FileList *filelist, FileSelType select, eDirEntry_SelectFlag flag, FileCheckType check)
void filelist_setrecursion (FileList *filelist, int recursion_level)
blender::asset_system::AssetLibraryfilelist_asset_library (FileList *filelist)
BlendHandle * filelist_lib (FileList *filelist)
bool filelist_islibrary (FileList *filelist, char *dir, char **r_group)
void filelist_freelib (FileList *filelist)
int filelist_files_num_entries (FileList *filelist)
void filelist_readjob_blocking_run (FileList *filelist, int space_notifier, const bContext *C)
void filelist_readjob_start (FileList *filelist, int space_notifier, const bContext *C)
void filelist_readjob_stop (FileList *filelist, wmWindowManager *wm)
int filelist_readjob_running (FileList *filelist, wmWindowManager *wm)
bool filelist_cache_previews_update (FileList *filelist)
void filelist_cache_previews_set (FileList *filelist, bool use_previews)
bool filelist_cache_previews_running (FileList *filelist)
bool filelist_cache_previews_done (FileList *filelist)

Typedef Documentation

◆ FileUID

using FileUID = uint32_t

Definition at line 33 of file filelist.hh.

Enumeration Type Documentation

◆ FileCheckType

Enumerator
CHECK_DIRS 
CHECK_FILES 
CHECK_ALL 

Definition at line 41 of file filelist.hh.

◆ FileSelType

Enumerator
FILE_SEL_REMOVE 
FILE_SEL_ADD 
FILE_SEL_TOGGLE 

Definition at line 35 of file filelist.hh.

Function Documentation

◆ filelist_asset_library()

◆ filelist_cache_previews_done()

◆ filelist_cache_previews_running()

bool filelist_cache_previews_running ( FileList * filelist)

Definition at line 1739 of file filelist.cc.

References FileList::filelist_cache, and FileListEntryCache::previews_pool.

Referenced by file_draw_list().

◆ filelist_cache_previews_set()

◆ filelist_cache_previews_update()

◆ filelist_clear()

void filelist_clear ( FileList * filelist)

◆ filelist_clear_ex()

◆ filelist_clear_from_reset_tag()

◆ filelist_dir()

const char * filelist_dir ( const FileList * filelist)

Get the root path of the file list. To get the full path for a file, use filelist_file_get_full_path().

Definition at line 1095 of file filelist.cc.

References FileList::filelist, and FileDirEntryArr::root.

Referenced by ED_file_change_dir_ex(), file_external_operation_exec(), file_os_operations_menu_draw(), and filelist_file_get_full_path().

◆ filelist_entries_select_index_range_set()

◆ filelist_entry_get_asset_representation()

blender::asset_system::AssetRepresentation * filelist_entry_get_asset_representation ( const FileList * filelist,
const int index )

◆ filelist_entry_get_id()

ID * filelist_entry_get_id ( const FileList * filelist,
int index )

Same as filelist_file_get_id(), but gets the file by index (doesn't require the file to be cached, uses FileListInternEntry only).

Definition at line 1332 of file filelist.cc.

References filelist_entry_intern_get(), FileListInternEntry::id, and FileListInternEntry::local_data.

Referenced by file_context().

◆ filelist_entry_get_relpath()

const char * filelist_entry_get_relpath ( const FileList * filelist,
int index )

Get the FileDirEntry.relpath value without requiring the FileDirEntry to be available (doesn't require the file to be cached, uses FileListInternEntry only).

Definition at line 1350 of file filelist.cc.

References filelist_entry_intern_get(), and FileListInternEntry::relpath.

Referenced by autocomplete_file(), and file_select_match().

◆ filelist_entry_is_selected()

◆ filelist_entry_parent_select_set()

void filelist_entry_parent_select_set ( FileList * filelist,
FileSelType select,
eDirEntry_SelectFlag flag,
FileCheckType check )

Set selection of the '..' parent entry, but only if it's actually visible.

Definition at line 2033 of file filelist.cc.

References filelist_entry_select_index_set(), FileList::filter_data, flag, FileListFilter::flags, FLF_HIDE_PARENT, and select.

Referenced by file_box_select_exec(), file_select_exec(), and file_walk_select_selection_set().

◆ filelist_entry_select_get()

◆ filelist_entry_select_index_get()

◆ filelist_entry_select_index_set()

◆ filelist_entry_select_set()

◆ filelist_file()

FileDirEntry * filelist_file ( FileList * filelist,
int index )

Request a file from the file browser cache, adding it to the cache if necessary.

As a rule of thumb, this can be used for operations on individual files (e.g. selection, active, renaming, etc.). But avoid calling this on many files (like when iterating the entire list), to not create a bunch of cache entries for a single operation. While a bit against the point of "intern" entries, in this case it's probably better to have queries like filelist_entry_get_id(), that take a file index and return data directly from the FileListInternEntry.

Definition at line 1285 of file filelist.cc.

References filelist_file_ex().

Referenced by ED_fileselect_activate_by_relpath(), ED_fileselect_active_asset_get(), ED_fileselect_selected_files_full_paths(), file_box_select_modal(), file_context(), file_delete_exec(), file_draw_list(), file_execute(), file_external_operation_exec(), file_os_operations_menu_draw(), file_params_renamefile_activate(), file_rename_state_activate(), file_select_do(), file_sfile_to_operator_ex(), filelist_entry_select_index_get(), filelist_entry_select_index_set(), filelist_geticon_get_file(), and fileselect_file_set().

◆ filelist_file_cache_block()

◆ filelist_file_cache_slidingwindow_set()

void filelist_file_cache_slidingwindow_set ( FileList * filelist,
size_t window_size )

◆ filelist_file_ex()

◆ filelist_file_find_id()

int filelist_file_find_id ( const FileList * filelist,
const ID * id )

◆ filelist_file_find_path()

int filelist_file_find_path ( FileList * filelist,
const char * filename )

Find a file from a file name, or more precisely, its file-list relative path, inside the filtered items.

Returns
The index of the found file or -1.

Definition at line 1290 of file filelist.cc.

References FileDirEntryArr::entries_filtered_num, FILEDIR_NBR_ENTRIES_UNSET, FileList::filelist, FileList::filelist_intern, FileListIntern::filtered, FileListInternEntry::relpath, and STREQ.

Referenced by file_params_find_renamed().

◆ filelist_file_get_full_path()

◆ filelist_file_get_id()

ID * filelist_file_get_id ( const FileDirEntry * file)

Get the ID a file represents (if any). For FILE_MAIN, FILE_MAIN_ASSET.

Definition at line 1345 of file filelist.cc.

References FileDirEntry::id.

Referenced by ED_fileselect_active_asset_get(), file_but_enable_drag(), file_context(), and file_draw_indicator_icons().

◆ filelist_file_get_preview_image()

ImBuf * filelist_file_get_preview_image ( const FileDirEntry * file)

◆ filelist_file_is_preview_pending()

bool filelist_file_is_preview_pending ( const FileList * filelist,
const FileDirEntry * file )

◆ filelist_files_ensure()

◆ filelist_files_num_entries()

int filelist_files_num_entries ( FileList * filelist)

Return the total raw number of entries listed in the given filelist, whether they are filtered out or not.

Definition at line 1045 of file filelist.cc.

References FileDirEntryArr::entries_num, and FileList::filelist.

Referenced by file_draw_hint_if_invalid().

◆ filelist_filter()

◆ filelist_free()

◆ filelist_free_icons()

void filelist_free_icons ( )

Definition at line 191 of file filelist.cc.

References _Max, BLI_assert, G, gSpecialFileImages, i, and IMB_freeImBuf().

Referenced by ED_file_exit().

◆ filelist_freelib()

◆ filelist_get_preview_image()

ImBuf * filelist_get_preview_image ( FileList * filelist,
int index )
Returns
True if a new preview request was pushed, false otherwise (e.g. because the preview is already loaded, invalid or not supported).

Definition at line 230 of file filelist.cc.

References BKE_icon_imbuf_get_buffer(), filelist_geticon_get_file(), and FileDirEntry::preview_icon_id.

Referenced by file_draw_list().

◆ filelist_geticon_file_type()

int filelist_geticon_file_type ( FileList * filelist,
int index,
bool is_main )

Definition at line 390 of file filelist.cc.

References filelist_geticon_file_type_ex(), and filelist_geticon_get_file().

Referenced by file_draw_list().

◆ filelist_geticon_special_file_image()

ImBuf * filelist_geticon_special_file_image ( FileList * filelist,
int index )

Get one of the larger document icons as image. E.g. a folder or file icon. A file type icon can be overlaid on top then.

Definition at line 270 of file filelist.cc.

References filelist_geticon_get_file(), and filelist_geticon_special_file_image_ex().

◆ filelist_geticon_special_file_image_ex()

◆ filelist_init_icons()

void filelist_init_icons ( )

◆ filelist_is_dir()

bool filelist_is_dir ( const FileList * filelist,
const char * path )

◆ filelist_is_ready()

◆ filelist_islibrary()

◆ filelist_lib()

BlendHandle * filelist_lib ( FileList * filelist)

Definition at line 1040 of file filelist.cc.

References FileList::libfiledata.

Referenced by ED_file_path_button().

◆ filelist_needs_filtering()

bool filelist_needs_filtering ( FileList * filelist)

Definition at line 269 of file filelist_filter.cc.

References FL_NEED_FILTERING, and FileList::flags.

Referenced by file_refresh().

◆ filelist_needs_force_reset()

◆ filelist_needs_reading()

◆ filelist_needs_reset_on_main_changes()

◆ filelist_new()

◆ filelist_pending()

bool filelist_pending ( const FileList * filelist)

◆ filelist_readjob_blocking_run()

void filelist_readjob_blocking_run ( FileList * filelist,
int space_notifier,
const bContext * C )

Forcibly run the job as a blocking task on the main thread.

Definition at line 3351 of file filelist.cc.

References C, and filelist_readjob_start_ex().

Referenced by blender::ed::asset::list::AssetList::ensure_blocking().

◆ filelist_readjob_running()

int filelist_readjob_running ( FileList * filelist,
wmWindowManager * wm )

Definition at line 3361 of file filelist.cc.

References filelist_jobtype_get(), and WM_jobs_test().

◆ filelist_readjob_start()

void filelist_readjob_start ( FileList * filelist,
int space_notifier,
const bContext * C )

May run the job in either the main thread or asynchronously.

Definition at line 3346 of file filelist.cc.

References C, and filelist_readjob_start_ex().

Referenced by blender::ed::asset::list::AssetList::fetch(), and file_refresh().

◆ filelist_readjob_stop()

◆ filelist_set_asset_catalog_filter_options()

void filelist_set_asset_catalog_filter_options ( FileList * filelist,
eFileSel_Params_AssetCatalogVisibility catalog_visibility,
const bUUID * catalog_id )
Parameters
catalog_idThe catalog that should be filtered by if catalog_visibility is FILE_SHOW_ASSETS_FROM_CATALOG. May be NULL otherwise.

Referenced by file_refresh().

◆ filelist_setdir()

void filelist_setdir ( FileList * filelist,
char dirpath[1282] )

May modify in place given dirpath, which is expected to be FILE_MAX_LIBEXTRA length.

References C, flag, and select.

Referenced by ED_file_change_dir_ex(), file_duplicate(), file_refresh(), and blender::ed::asset::list::AssetList::setup().

◆ filelist_setfilter_options()

void filelist_setfilter_options ( FileList * filelist,
bool do_filter,
bool hide_dot,
bool hide_parent,
uint64_t filter,
uint64_t filter_id,
bool filter_assets_only,
const char * filter_glob,
const char * filter_search )

◆ filelist_setindexer()

void filelist_setindexer ( FileList * filelist,
const FileIndexerType * indexer )

Set the indexer to be used by the filelist.

The given indexer allocation should be handled by the caller or defined statically.

Definition at line 118 of file filelist.cc.

References BLI_assert, and FileList::indexer.

Referenced by file_refresh(), and blender::ed::asset::list::AssetList::setup().

◆ filelist_setlibrary()

void filelist_setlibrary ( FileList * filelist,
const AssetLibraryReference * asset_library_ref )
Parameters
asset_library_refMay be NULL to unset the library.

Definition at line 166 of file filelist.cc.

References FileList::asset_library_ref, filelist_compare_asset_libraries(), FL_FORCE_RESET, FileList::flags, MEM_callocN(), and MEM_SAFE_FREE.

Referenced by file_refresh(), and blender::ed::asset::list::AssetList::setup().

◆ filelist_setrecursion()

void filelist_setrecursion ( FileList * filelist,
int recursion_level )

◆ filelist_setsorting()

void filelist_setsorting ( FileList * filelist,
short sort,
bool invert_sort )

◆ filelist_settype()

◆ filelist_sort()

◆ filelist_tag_force_reset()

void filelist_tag_force_reset ( FileList * filelist)

Definition at line 1135 of file filelist.cc.

References FL_FORCE_RESET, and FileList::flags.

Referenced by blender::ed::asset::list::AssetList::clear().

◆ filelist_tag_force_reset_mainfiles()

◆ filelist_tag_needs_filtering()

◆ filelist_tag_reload_asset_library()

void filelist_tag_reload_asset_library ( FileList * filelist)

◆ filelist_uid_is_set()

bool filelist_uid_is_set ( const FileUID uid)

Definition at line 1366 of file filelist.cc.

References filelist_uid_unset().

◆ filelist_uid_unset()

void filelist_uid_unset ( FileUID * r_uid)

Definition at line 1373 of file filelist.cc.

References FILE_UID_UNSET.

Referenced by filelist_readjob_startjob(), and filelist_uid_is_set().