diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-03-24 03:34:18 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-03-24 05:41:18 +0300 |
commit | c46dcdf8871e7404516a234087cfc4bf4e2794d0 (patch) | |
tree | ca5f6d549a3294441a452ae04507e46360324bad /source/blender/editors/interface/interface_handlers.c | |
parent | 94b8166a8b0519aef76e8cb8d0c9a6035fe04baf (diff) |
UI: add menu search functionality to operator search menu
This has some advantages over operator search:
- Some operators need options set to be usefully accessed.
- Shows key bindings to access menus
(for actions that don't have key bindings themselves).
- Non operator actions such as check-boxes are also shown.
- Menu items can control execution context, using invoke or execute
where appropriate so we can control how the operator runs.
Part of the design task T74157.
This can be tested using the 'Experimental' preferences section
or selected in the key-map editor.
Diffstat (limited to 'source/blender/editors/interface/interface_handlers.c')
-rw-r--r-- | source/blender/editors/interface/interface_handlers.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 238223fddfd..2dfa29f5646 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -421,6 +421,9 @@ typedef struct uiAfterFunc { PointerRNA rnapoin; PropertyRNA *rnaprop; + void *search_arg; + uiButSearchArgFreeFunc search_arg_free_func; + bContextStore *context; char undostr[BKE_UNDO_STR_MAX]; @@ -755,6 +758,11 @@ static void ui_apply_but_func(bContext *C, uiBut *but) after->rnapoin = but->rnapoin; after->rnaprop = but->rnaprop; + after->search_arg_free_func = but->search_arg_free_func; + after->search_arg = but->search_arg; + but->search_arg_free_func = NULL; + but->search_arg = NULL; + if (but->context) { after->context = CTX_store_copy(but->context); } @@ -921,6 +929,10 @@ static void ui_apply_but_funcs_after(bContext *C) MEM_freeN(after.rename_orig); } + if (after.search_arg_free_func) { + after.search_arg_free_func(after.search_arg); + } + ui_afterfunc_update_preferences_dirty(&after); if (after.undostr[0]) { |