[Bf-blender-cvs] [eafd98c920a] asset-browser-grid-view: Remove preview-caching from asset-list API
Julian Eisel
noreply at git.blender.org
Wed Feb 16 18:13:18 CET 2022
Commit: eafd98c920a49a8aa6b1c8b051f4faab06a0f2d8
Author: Julian Eisel
Date: Wed Feb 16 18:10:40 2022 +0100
Branches: asset-browser-grid-view
https://developer.blender.org/rBeafd98c920a49a8aa6b1c8b051f4faab06a0f2d8
Remove preview-caching from asset-list API
This isn't needed anymore, see previous commit.
===================================================================
M source/blender/editors/asset/ED_asset_list.h
M source/blender/editors/asset/intern/asset_list.cc
M source/blender/editors/interface/interface_template_asset_view.cc
M source/blender/editors/space_assets/asset_view.cc
M source/blender/windowmanager/WM_types.h
===================================================================
diff --git a/source/blender/editors/asset/ED_asset_list.h b/source/blender/editors/asset/ED_asset_list.h
index ddf1b07033e..607d3e96ada 100644
--- a/source/blender/editors/asset/ED_asset_list.h
+++ b/source/blender/editors/asset/ED_asset_list.h
@@ -25,8 +25,6 @@ struct wmNotifier;
*/
void ED_assetlist_storage_fetch(const struct AssetLibraryReference *library_reference,
const struct bContext *C);
-void ED_assetlist_ensure_previews_job(const struct AssetLibraryReference *library_reference,
- const struct bContext *C);
void ED_assetlist_catalog_filter_set(const struct AssetLibraryReference *,
const struct AssetCatalogFilterSettings *catalog_filter);
void ED_assetlist_clear(const struct AssetLibraryReference *library_reference, struct bContext *C);
diff --git a/source/blender/editors/asset/intern/asset_list.cc b/source/blender/editors/asset/intern/asset_list.cc
index 785c238bfae..433ca7360d6 100644
--- a/source/blender/editors/asset/intern/asset_list.cc
+++ b/source/blender/editors/asset/intern/asset_list.cc
@@ -76,28 +76,6 @@ class FileListWrapper {
}
};
-class PreviewTimer {
- /* Non-owning! The Window-Manager registers and owns this. */
- wmTimer *timer_ = nullptr;
-
- public:
- void ensureRunning(const bContext *C)
- {
- if (!timer_) {
- timer_ = WM_event_add_timer_notifier(
- CTX_wm_manager(C), CTX_wm_window(C), NC_ASSET | ND_ASSET_LIST_PREVIEW, 0.01);
- }
- }
-
- void stop(const bContext *C)
- {
- if (timer_) {
- WM_event_remove_timer_notifier(CTX_wm_manager(C), CTX_wm_window(C), timer_);
- timer_ = nullptr;
- }
- }
-};
-
class AssetList : NonCopyable {
FileListWrapper filelist_;
/** Storage for asset handles, items are lazy-created on request.
@@ -105,7 +83,6 @@ class AssetList : NonCopyable {
* inside the map changes as the map changes). */
mutable Map<const FileDirEntry *, std::unique_ptr<AssetHandle>> asset_handle_map_;
AssetLibraryReference library_ref_;
- PreviewTimer previews_timer_;
public:
AssetList() = delete;
@@ -116,7 +93,6 @@ class AssetList : NonCopyable {
void setup();
void fetch(const bContext &C);
void setCatalogFilterSettings(const AssetCatalogFilterSettings &settings);
- void ensurePreviewsJob(const bContext *C);
void clear(bContext *C);
bool needsRefetch() const;
@@ -233,30 +209,6 @@ void AssetList::iterate(AssetListIterFn fn) const
}
}
-void AssetList::ensurePreviewsJob(const bContext *C)
-{
- FileList *files = filelist_;
- int numfiles = filelist_files_ensure(files);
-
- filelist_cache_previews_set(files, true);
- filelist_file_cache_slidingwindow_set(files, 256);
- /* TODO fetch all previews for now. */
- filelist_file_cache_block(files, numfiles / 2);
- filelist_cache_previews_update(files);
-
- {
- const bool previews_running = filelist_cache_previews_running(files) &&
- !filelist_cache_previews_done(files);
- if (previews_running) {
- previews_timer_.ensureRunning(C);
- }
- else {
- /* Preview is not running, no need to keep generating update events! */
- previews_timer_.stop(C);
- }
- }
-}
-
void AssetList::clear(bContext *C)
{
/* Based on #ED_fileselect_clear() */
@@ -287,7 +239,7 @@ bool AssetList::listen(const wmNotifier ¬ifier) const
filelist_tag_needs_filtering(filelist_);
return true;
}
- if (ELEM(notifier.data, ND_ASSET_LIST_READING, ND_ASSET_LIST_PREVIEW)) {
+ if (ELEM(notifier.data, ND_ASSET_LIST_READING)) {
return true;
}
if (ELEM(notifier.action, NA_ADDED, NA_REMOVED, NA_EDITED)) {
@@ -453,16 +405,6 @@ void ED_assetlist_storage_fetch(const AssetLibraryReference *library_reference,
AssetListStorage::fetch_library(*library_reference, *C);
}
-void ED_assetlist_ensure_previews_job(const AssetLibraryReference *library_reference,
- const bContext *C)
-{
-
- AssetList *list = AssetListStorage::lookup_list(*library_reference);
- if (list) {
- list->ensurePreviewsJob(C);
- }
-}
-
void ED_assetlist_catalog_filter_set(const struct AssetLibraryReference *library_reference,
const struct AssetCatalogFilterSettings *settings)
{
diff --git a/source/blender/editors/interface/interface_template_asset_view.cc b/source/blender/editors/interface/interface_template_asset_view.cc
index b83dfcfa0db..ad0fea69d67 100644
--- a/source/blender/editors/interface/interface_template_asset_view.cc
+++ b/source/blender/editors/interface/interface_template_asset_view.cc
@@ -220,7 +220,6 @@ void uiTemplateAssetView(uiLayout *layout,
}
ED_assetlist_storage_fetch(&asset_library_ref, C);
- ED_assetlist_ensure_previews_job(&asset_library_ref, C);
const int tot_items = ED_assetlist_size(&asset_library_ref);
asset_view_template_refresh_asset_collection(
diff --git a/source/blender/editors/space_assets/asset_view.cc b/source/blender/editors/space_assets/asset_view.cc
index f13b6f52934..a527e050c4b 100644
--- a/source/blender/editors/space_assets/asset_view.cc
+++ b/source/blender/editors/space_assets/asset_view.cc
@@ -106,7 +106,6 @@ void asset_view_create_in_layout(const bContext &C,
UI_block_layout_set_current(block, &layout);
ED_assetlist_storage_fetch(&asset_library_ref, &C);
- ED_assetlist_ensure_previews_job(&asset_library_ref, &C);
ED_assetlist_catalog_filter_set(&asset_library_ref, &catalog_filter_settings);
ui::AbstractGridView *grid_view = UI_block_add_view(
diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h
index 6158a70c6c8..332a5db41ea 100644
--- a/source/blender/windowmanager/WM_types.h
+++ b/source/blender/windowmanager/WM_types.h
@@ -448,9 +448,6 @@ typedef struct wmNotifier {
/* Denote that something in the contents of an AssetList may have changed. Triggers re-filtering of
* items. */
#define ND_ASSET_LIST (1 << 16)
-/* Denotes that the AssetList is done reading some previews. NOT that the preview generation of
- * assets is done. */
-#define ND_ASSET_LIST_PREVIEW (2 << 16)
#define ND_ASSET_LIST_READING (3 << 16)
/* Catalog data changed, requiring a redraw of catalog UIs. Note that this doesn't denote a
* reloading of asset libraries & their catalogs should happen. That only happens on explicit user
More information about the Bf-blender-cvs
mailing list