[Bf-blender-cvs] [74364a3928a] master: UI: add popover access for button labels
Campbell Barton
noreply at git.blender.org
Wed Jun 19 04:06:49 CEST 2019
Commit: 74364a3928a15bf1380dc0498b3632e6354049d2
Author: Campbell Barton
Date: Wed Jun 19 11:34:54 2019 +1000
Branches: master
https://developer.blender.org/rB74364a3928a15bf1380dc0498b3632e6354049d2
UI: add popover access for button labels
Needed for tool-tips to access labels.
===================================================================
M source/blender/editors/interface/interface.c
===================================================================
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. */
}
}
}
More information about the Bf-blender-cvs
mailing list