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:36:36 +0300
committerJulian Eisel <julian@blender.org>2022-11-01 19:43:38 +0300
commit78a7d5cfccdc09293acd97e789d60bfd806910c5 (patch)
tree028e3c94f1cbaf1fbb73ec102e48c674982a8e61 /source/blender/editors/interface/interface.cc
parentbcc2656299ad72b224c5f2644518759561c31045 (diff)
UI: Support C defined menu types to listen to notifiers
Needed to dynamically load assets as menu items, see cf985180551d and 99e5024e97f1. The next commit will add the listener for the node add menu.
Diffstat (limited to 'source/blender/editors/interface/interface.cc')
-rw-r--r--source/blender/editors/interface/interface.cc15
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface.cc b/source/blender/editors/interface/interface.cc
index 1f88d25af2b..331d1581db5 100644
--- a/source/blender/editors/interface/interface.cc
+++ b/source/blender/editors/interface/interface.cc
@@ -3474,6 +3474,7 @@ void UI_block_free(const bContext *C, uiBlock *block)
BLI_freelistN(&block->saferct);
BLI_freelistN(&block->color_pickers.list);
+ BLI_freelistN(&block->dynamic_listeners);
ui_block_free_button_groups(block);
ui_block_free_views(block);
@@ -3481,6 +3482,20 @@ void UI_block_free(const bContext *C, uiBlock *block)
MEM_freeN(block);
}
+void UI_block_listen(const uiBlock *block, const wmRegionListenerParams *listener_params)
+{
+ /* Don't need to let invisible blocks (old blocks from previous redraw) listen. */
+ if (!block->active) {
+ return;
+ }
+
+ LISTBASE_FOREACH (uiBlockDynamicListener *, listener, &block->dynamic_listeners) {
+ listener->listener_func(listener_params);
+ }
+
+ ui_block_views_listen(block, listener_params);
+}
+
void UI_blocklist_update_window_matrix(const bContext *C, const ListBase *lb)
{
ARegion *region = CTX_wm_region(C);