diff options
author | Julian Eisel <julian@blender.org> | 2020-12-14 15:50:36 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2020-12-15 19:03:48 +0300 |
commit | 70474e1a7cc45a1b1cc08d39b3e472c88c8d3225 (patch) | |
tree | 1f973b96e0b6c78e4b30e4413517a994e59ff744 /source/blender/editors/space_file/filelist.h | |
parent | e413c80371c1714d80262034d0e83b4e10e6cbe5 (diff) |
Asset System: Prepare File Browser backend for the Asset Browser
The Asset Browser will be a sub-editor of the File Browser. This prepares the
File Browser code for that.
**File-Lists**
* Support loading assets with metadata read from external files into the
file-list.
* New main based file-list type, for the "Current File" asset library.
* Refresh file-list when switching between browse modes or asset libraries.
* Support empty file-lists (asset library with no assets).
* Store file previews as icons, so scripts can reference them via icon-id. See
previous commit.
**Space Data**
* Introduce "browse mode" to differeniate between file and asset browsing.
* Add `FileAssetSelectParams` to `SpaceFile`, with `FileSelectParams` as base.
Makes sure data is separated between asset and file browsing when switching
between them. The active params can be obtained through
`ED_fileselect_get_active_params()`.
* `FileAssetSelectParams` stores the currently visible asset library ID.
* Introduce file history abstraction so file and asset browsing can keep a
separate history (previous and next directories).
**General**
* Option to only show asset data-blocks while file browsing (not exposed here).
* Add "active_file" context member, so scripts can get and display info about
the active file.
* Add "active_id" context member, so `ED_OT_lib_id_load_custom_preview` can set
a custom ID preview. (Only for "Current File" asset library)
* Expose some of `FileDirEntry` in RNA as (non-editable). That way scripts can
obtain name, preview icon and asset-data.
Part of the first Asset Browser milestone. Check the #asset_browser_milestone_1
project milestone on developer.blender.org.
Differential Revision: https://developer.blender.org/D9724
Reviewed by: Bastien Montagne
Diffstat (limited to 'source/blender/editors/space_file/filelist.h')
-rw-r--r-- | source/blender/editors/space_file/filelist.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/source/blender/editors/space_file/filelist.h b/source/blender/editors/space_file/filelist.h index 4b8cc052382..59bd5bb50d7 100644 --- a/source/blender/editors/space_file/filelist.h +++ b/source/blender/editors/space_file/filelist.h @@ -30,6 +30,7 @@ extern "C" { struct BlendHandle; struct FileList; struct FileSelection; +struct FileSelectAssetLibraryUID; struct wmWindowManager; struct FileDirEntry; @@ -46,14 +47,16 @@ typedef enum FileCheckType { CHECK_ALL = 3, } FileCheckType; -struct ListBase *folderlist_new(void); void folderlist_free(struct ListBase *folderlist); -struct ListBase *folderlist_duplicate(ListBase *folderlist); void folderlist_popdir(struct ListBase *folderlist, char *dir); void folderlist_pushdir(struct ListBase *folderlist, const char *dir); const char *folderlist_peeklastdir(struct ListBase *folderlist); int folderlist_clear_next(struct SpaceFile *sfile); +void folder_history_list_ensure_for_active_browse_mode(struct SpaceFile *sfile); +void folder_history_list_free(struct SpaceFile *sfile); +struct ListBase folder_history_list_duplicate(struct ListBase *listbase); + void filelist_setsorting(struct FileList *filelist, const short sort, bool invert_sort); void filelist_sort(struct FileList *filelist); @@ -63,17 +66,22 @@ void filelist_setfilter_options(struct FileList *filelist, const bool hide_parent, const uint64_t filter, const uint64_t filter_id, + const bool filter_assets_only, const char *filter_glob, const char *filter_search); void filelist_filter(struct FileList *filelist); +void filelist_setlibrary(struct FileList *filelist, + const struct FileSelectAssetLibraryUID *asset_library); void filelist_init_icons(void); void filelist_free_icons(void); struct ImBuf *filelist_getimage(struct FileList *filelist, const int index); +struct ImBuf *filelist_file_getimage(const FileDirEntry *file); struct ImBuf *filelist_geticon_image(struct FileList *filelist, const int index); int filelist_geticon(struct FileList *filelist, const int index, const bool is_main); struct FileList *filelist_new(short type); +void filelist_settype(struct FileList *filelist, short type); void filelist_clear(struct FileList *filelist); void filelist_clear_ex(struct FileList *filelist, const bool do_cache, const bool do_selection); void filelist_free(struct FileList *filelist); @@ -83,15 +91,18 @@ bool filelist_is_dir(struct FileList *filelist, const char *path); void filelist_setdir(struct FileList *filelist, char *r_dir); int filelist_files_ensure(struct FileList *filelist); -int filelist_empty(struct FileList *filelist); +int filelist_needs_reading(struct FileList *filelist); FileDirEntry *filelist_file(struct FileList *filelist, int index); int filelist_file_findpath(struct FileList *filelist, const char *file); +struct ID *filelist_file_get_id(const struct FileDirEntry *file); FileDirEntry *filelist_entry_find_uuid(struct FileList *filelist, const int uuid[4]); void filelist_file_cache_slidingwindow_set(struct FileList *filelist, size_t window_size); bool filelist_file_cache_block(struct FileList *filelist, const int index); -bool filelist_force_reset(struct FileList *filelist); +bool filelist_needs_force_reset(struct FileList *filelist); +void filelist_tag_force_reset(struct FileList *filelist); bool filelist_pending(struct FileList *filelist); +bool filelist_needs_reset_on_main_changes(const struct FileList *filelist); bool filelist_is_ready(struct FileList *filelist); unsigned int filelist_entry_select_set(const struct FileList *filelist, |