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>2019-06-19 04:34:54 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-06-19 04:34:54 +0300
commit74364a3928a15bf1380dc0498b3632e6354049d2 (patch)
tree41fd6527e38b275cfd194d3a2f962064e6ed8df4
parent2f5a79b390627e6f75d97eb7c2099dbe3d566fb5 (diff)
UI: add popover access for button labels
Needed for tool-tips to access labels.
-rw-r--r--source/blender/editors/interface/interface.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 4b1bdc4a534..697c289491a 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -6401,18 +6401,35 @@ void UI_but_string_info_get(bContext *C, uiBut *but, ...)
}
}
}
- else if (ELEM(but->type, UI_BTYPE_MENU, UI_BTYPE_PULLDOWN)) {
- MenuType *mt = UI_but_menutype_get(but);
- if (mt) {
- /* not all menus are from python */
- if (mt->ext.srna) {
+ else if (ELEM(but->type, UI_BTYPE_MENU, UI_BTYPE_PULLDOWN, UI_BTYPE_POPOVER)) {
+ {
+ MenuType *mt = UI_but_menutype_get(but);
+ if (mt) {
+ if (type == BUT_GET_RNA_LABEL) {
+ tmp = BLI_strdup(mt->label);
+ }
+ else {
+ /* Not all menus are from Python. */
+ if (mt->ext.srna) {
+ const char *t = RNA_struct_ui_description(mt->ext.srna);
+ if (t && t[0]) {
+ tmp = BLI_strdup(t);
+ }
+ }
+ }
+ }
+ }
+
+ if (tmp == NULL) {
+ PanelType *pt = UI_but_paneltype_get(but);
+ if (pt) {
if (type == BUT_GET_RNA_LABEL) {
- tmp = BLI_strdup(RNA_struct_ui_name(mt->ext.srna));
+ tmp = BLI_strdup(pt->label);
}
else {
- const char *t = RNA_struct_ui_description(mt->ext.srna);
- if (t && t[0]) {
- tmp = BLI_strdup(t);
+ /* Not all panels are from Python. */
+ if (pt->ext.srna) {
+ /* Panels don't yet have descriptions, this may be added. */
}
}
}