Blender V4.3
filelist.hh File Reference

Go to the source code of this file.

Namespaces

namespace  blender
 
namespace  blender::asset_system
 

Typedefs

typedef uint32_t FileUID
 

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)
 
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[])
 
bool filelist_file_is_preview_pending (const FileList *filelist, const FileDirEntry *file)
 
bool filelist_file_ensure_preview_requested (FileList *filelist, FileDirEntry *file)
 
ImBuffilelist_getimage (FileList *filelist, int index)
 
ImBuffilelist_file_getimage (const FileDirEntry *file)
 
ImBuffilelist_geticon_image_ex (const FileDirEntry *file)
 
ImBuffilelist_geticon_image (FileList *filelist, int index)
 
int filelist_geticon (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[1090])
 
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)
 
void filelist_set_no_preview_auto_cache (FileList *filelist)
 
bool filelist_needs_force_reset (const FileList *filelist)
 
void filelist_tag_force_reset (FileList *filelist)
 
void filelist_tag_force_reset_mainfiles (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_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)
 
void filelist_cache_previews_ensure_running (FileList *filelist)
 
bool filelist_cache_previews_update (FileList *filelist)
 
bool filelist_cache_previews_enabled (const 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

typedef uint32_t FileUID

Definition at line 28 of file filelist.hh.

Enumeration Type Documentation

◆ FileCheckType

Enumerator
CHECK_DIRS 
CHECK_FILES 
CHECK_ALL 

Definition at line 36 of file filelist.hh.

◆ FileSelType

Enumerator
FILE_SEL_REMOVE 
FILE_SEL_ADD 
FILE_SEL_TOGGLE 

Definition at line 30 of file filelist.hh.

Function Documentation

◆ filelist_asset_library()

◆ filelist_cache_previews_done()

◆ filelist_cache_previews_enabled()

◆ filelist_cache_previews_ensure_running()

void filelist_cache_previews_ensure_running ( FileList * filelist)

◆ filelist_cache_previews_running()

bool filelist_cache_previews_running ( FileList * filelist)

◆ filelist_cache_previews_set()

◆ filelist_cache_previews_update()

◆ filelist_clear()

void filelist_clear ( FileList * filelist)

◆ filelist_clear_ex()

◆ filelist_clear_from_reset_tag()

void filelist_clear_from_reset_tag ( FileList * filelist)

A "smarter" version of filelist_clear() that calls partial clearing based on the filelist force-reset flags.

Definition at line 1970 of file filelist.cc.

References filelist_clear(), filelist_clear_main_files(), FL_FORCE_RESET, FL_FORCE_RESET_MAIN_FILES, and FileList::flags.

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

◆ 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 2075 of file filelist.cc.

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

Referenced by ED_file_change_dir_ex(), 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 2312 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 2330 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 3027 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 2265 of file filelist.cc.

References filelist_file_ex().

Referenced by blender::ed::asset::list::AssetList::asset_get_by_index(), ED_fileselect_activate_by_relpath(), ED_fileselect_active_asset_get(), file_box_select_modal(), file_context(), file_delete_exec(), file_draw_list(), file_execute(), 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(), fileselect_file_set(), and blender::ed::asset::list::AssetList::iterate().

◆ filelist_file_cache_block()

◆ filelist_file_cache_slidingwindow_set()

void filelist_file_cache_slidingwindow_set ( FileList * filelist,
size_t window_size )

Definition at line 2358 of file filelist.cc.

References FileList::filelist_cache, filelist_cache_clear(), and FileListEntryCache::size.

Referenced by file_draw_list().

◆ filelist_file_ensure_preview_requested()

bool filelist_file_ensure_preview_requested ( FileList * filelist,
FileDirEntry * file )
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 1168 of file filelist.cc.

References filelist_cache_previews_enabled(), filelist_cache_previews_push(), filelist_file_preview_load_poll(), filelist_files_ensure(), FileList::filelist_intern, FileListIntern::filtered, and FileListInternEntry::uid.

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

◆ 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 2270 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()

void filelist_file_get_full_path ( const FileList * filelist,
const FileDirEntry * file,
char r_filepath[] )

◆ 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 2325 of file filelist.cc.

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

◆ filelist_file_getimage()

ImBuf * filelist_file_getimage ( 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 2025 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 1136 of file filelist.cc.

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

Referenced by ED_file_exit().

◆ filelist_freelib()

void filelist_freelib ( FileList * filelist)

◆ filelist_geticon()

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

Definition at line 1367 of file filelist.cc.

References filelist_geticon_ex(), and filelist_geticon_get_file().

Referenced by file_draw_list().

◆ filelist_geticon_image()

ImBuf * filelist_geticon_image ( FileList * filelist,
int index )

Definition at line 1244 of file filelist.cc.

References filelist_geticon_get_file(), and filelist_geticon_image_ex().

Referenced by file_draw_list().

◆ filelist_geticon_image_ex()

ImBuf * filelist_geticon_image_ex ( const FileDirEntry * file)

◆ filelist_getimage()

ImBuf * filelist_getimage ( FileList * filelist,
int index )

Definition at line 1204 of file filelist.cc.

References BKE_icon_imbuf_get_buffer(), and filelist_geticon_get_file().

Referenced by file_draw_list().

◆ 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()

bool filelist_islibrary ( FileList * filelist,
char * dir,
char ** r_group )

◆ filelist_lib()

BlendHandle * filelist_lib ( FileList * filelist)

Definition at line 2020 of file filelist.cc.

References FileList::libfiledata.

Referenced by ED_file_path_button().

◆ 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_running()

int filelist_readjob_running ( FileList * filelist,
wmWindowManager * wm )

Definition at line 4332 of file filelist.cc.

References filelist_jobtype_get(), and WM_jobs_test().

◆ filelist_readjob_start()

◆ 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.

◆ filelist_set_no_preview_auto_cache()

void filelist_set_no_preview_auto_cache ( FileList * filelist)

Definition at line 2110 of file filelist.cc.

References FL_PREVIEWS_NO_AUTO_CACHE, and FileList::flags.

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

◆ filelist_setdir()

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

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

◆ 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 1063 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 1111 of file filelist.cc.

References FileList::asset_library_ref, filelist_compare_asset_libraries(), FL_FORCE_RESET, FileList::flags, 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 2120 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_uid_is_set()

bool filelist_uid_is_set ( const FileUID uid)

Definition at line 2346 of file filelist.cc.

References filelist_uid_unset().

◆ filelist_uid_unset()

void filelist_uid_unset ( FileUID * r_uid)

Definition at line 2353 of file filelist.cc.

References FILE_UID_UNSET.

Referenced by filelist_readjob_startjob(), and filelist_uid_is_set().