Fix asset loading indicator in node add menu disappearing too early

The "Loading Asset Libraries" label in the menu would already disappear
before the asset libraries are done loading. It only queried if the
loading was started, not if it was finished. Especially notable when the
asset library was slow to load, e.g. because it is not yet in the asset
index.
This commit is contained in:
Julian Eisel 2022-12-13 17:25:40 +01:00
parent a243a9dc79
commit f4912e7f5b
1 changed files with 7 additions and 1 deletions

View File

@ -111,6 +111,7 @@ class AssetList : NonCopyable {
void clear(bContext *C);
bool needsRefetch() const;
bool isLoaded() const;
void iterate(AssetListIterFn fn) const;
bool listen(const wmNotifier &notifier) const;
int size() const;
@ -189,6 +190,11 @@ bool AssetList::needsRefetch() const
return filelist_needs_force_reset(filelist_) || filelist_needs_reading(filelist_);
}
bool AssetList::isLoaded() const
{
return filelist_is_ready(filelist_);
}
void AssetList::iterate(AssetListIterFn fn) const
{
FileList *files = filelist_;
@ -422,7 +428,7 @@ bool ED_assetlist_is_loaded(const AssetLibraryReference *library_reference)
if (list->needsRefetch()) {
return false;
}
return true;
return list->isLoaded();
}
void ED_assetlist_ensure_previews_job(const AssetLibraryReference *library_reference,