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:
authorCampbell Barton <ideasman42@gmail.com>2018-07-13 11:57:25 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-07-13 11:57:25 +0300
commit399cbd3b6bb9e23333ecc37231c8149056affda1 (patch)
treed7d0f436036f631b9ca5326a359f18a32d19f4d7 /source/blender/editors/interface
parentef423d9876378bf7568da69b70594f1d5d18f376 (diff)
UI: show popover shortcuts in tooltip
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r--source/blender/editors/interface/interface.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 6df54c0a31c..3e01c5f356f 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -998,6 +998,41 @@ static bool ui_but_event_operator_string_from_menu(
return found;
}
+static bool ui_but_event_operator_string_from_panel(
+ const bContext *C, uiBut *but,
+ char *buf, const size_t buf_len)
+{
+ /** Nearly exact copy of #ui_but_event_operator_string_from_menu */
+ PanelType *pt = UI_but_paneltype_get(but);
+ BLI_assert(pt != NULL);
+
+ bool found = false;
+ IDProperty *prop_panel;
+
+ /* annoying, create a property */
+ IDPropertyTemplate val = {0};
+ prop_panel = IDP_New(IDP_GROUP, &val, __func__); /* dummy, name is unimportant */
+ IDP_AddToGroup(prop_panel, IDP_NewString(pt->idname, "name", sizeof(pt->idname)));
+ IDP_AddToGroup(prop_panel, IDP_New(IDP_INT, &(IDPropertyTemplate){ .i = pt->space_type, }, "space_type"));
+ IDP_AddToGroup(prop_panel, IDP_New(IDP_INT, &(IDPropertyTemplate){ .i = pt->region_type, }, "region_type"));
+
+ for (int i = 0; i < 2; i++) {
+ /* FIXME(campbell): We can't reasonably search all configurations - long term. */
+ IDP_ReplaceInGroup(prop_panel, IDP_New(IDP_INT, &(IDPropertyTemplate){ .i = i, }, "keep_open"));
+ if (WM_key_event_operator_string(
+ C, "WM_OT_call_panel", WM_OP_INVOKE_REGION_WIN, prop_panel, true,
+ buf, buf_len))
+ {
+ found = true;
+ break;
+ }
+ }
+
+ IDP_FreeProperty(prop_panel);
+ MEM_freeN(prop_panel);
+ return found;
+}
+
static bool ui_but_event_operator_string(
const bContext *C, uiBut *but,
char *buf, const size_t buf_len)
@@ -1010,6 +1045,9 @@ static bool ui_but_event_operator_string(
else if (UI_but_menutype_get(but) != NULL) {
found = ui_but_event_operator_string_from_menu(C, but, buf, buf_len);
}
+ else if (UI_but_paneltype_get(but) != NULL) {
+ found = ui_but_event_operator_string_from_panel(C, but, buf, buf_len);
+ }
return found;
}