Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2022-11-01 19:39:26 +0300
committerJulian Eisel <julian@blender.org>2022-11-01 19:43:55 +0300
commit518d7dbebbdce2d5a347c7e53eae216a56f44e2a (patch)
tree04fbee2ed7d5131b1f7887f17ab88f3dff84b622
parent78a7d5cfccdc09293acd97e789d60bfd806910c5 (diff)
UI/Nodes: Update node add menu as assets get loaded
Adds a listener to the node add menu so that it refreshes as assets get loaded asynchronously. Followup to cf985180551d, also see 99e5024e97f1 and the previous commit.
-rw-r--r--source/blender/editors/space_node/add_menu_assets.cc17
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/editors/space_node/add_menu_assets.cc b/source/blender/editors/space_node/add_menu_assets.cc
index 4e305ac8af4..1ba1d67d854 100644
--- a/source/blender/editors/space_node/add_menu_assets.cc
+++ b/source/blender/editors/space_node/add_menu_assets.cc
@@ -17,6 +17,7 @@
#include "RNA_prototypes.h"
#include "ED_asset.h"
+#include "ED_screen.h"
#include "node_intern.hh"
@@ -27,6 +28,20 @@ static bool node_add_menu_poll(const bContext *C, MenuType * /*mt*/)
return CTX_wm_space_node(C);
}
+static void node_add_menu_assets_listen_fn(const wmRegionListenerParams *params)
+{
+ const wmNotifier *wmn = params->notifier;
+ ARegion *region = params->region;
+
+ switch (wmn->category) {
+ case NC_ASSET:
+ if (wmn->data == ND_ASSET_LIST_READING) {
+ ED_region_tag_refresh_ui(region);
+ }
+ break;
+ }
+}
+
struct LibraryAsset {
AssetLibraryReference library_ref;
AssetHandle handle;
@@ -261,6 +276,7 @@ MenuType add_catalog_assets_menu_type()
BLI_strncpy(type.idname, "NODE_MT_node_add_catalog_assets", sizeof(type.idname));
type.poll = node_add_menu_poll;
type.draw = node_add_catalog_assets_draw;
+ type.listener = node_add_menu_assets_listen_fn;
return type;
}
@@ -270,6 +286,7 @@ MenuType add_root_catalogs_menu_type()
BLI_strncpy(type.idname, "NODE_MT_node_add_root_catalogs", sizeof(type.idname));
type.poll = node_add_menu_poll;
type.draw = add_root_catalogs_draw;
+ type.listener = node_add_menu_assets_listen_fn;
return type;
}