[Bf-blender-cvs] [f4912e7f5b2] master: Fix asset loading indicator in node add menu disappearing too early

Julian Eisel noreply at git.blender.org
Wed Dec 14 15:43:15 CET 2022


Commit: f4912e7f5b250b00e34888d79549f91562817654
Author: Julian Eisel
Date:   Tue Dec 13 17:25:40 2022 +0100
Branches: master
https://developer.blender.org/rBf4912e7f5b250b00e34888d79549f91562817654

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.

===================================================================

M	source/blender/editors/asset/intern/asset_list.cc

===================================================================

diff --git a/source/blender/editors/asset/intern/asset_list.cc b/source/blender/editors/asset/intern/asset_list.cc
index 5b3d256c70c..caceedbd4a5 100644
--- a/source/blender/editors/asset/intern/asset_list.cc
+++ b/source/blender/editors/asset/intern/asset_list.cc
@@ -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,



More information about the Bf-blender-cvs mailing list