[Bf-blender-cvs] [1df068c] master: UI: Fix for rna-enum submenus not showing a right arrow

Campbell Barton noreply at git.blender.org
Thu Feb 20 03:32:41 CET 2014


Commit: 1df068c39a8a4d58272795aff135867f76b2b937
Author: Campbell Barton
Date:   Thu Feb 20 13:30:52 2014 +1100
https://developer.blender.org/rB1df068c39a8a4d58272795aff135867f76b2b937

UI: Fix for rna-enum submenus not showing a right arrow

===================================================================

M	source/blender/editors/interface/interface.c
M	source/blender/editors/interface/interface_widgets.c

===================================================================

diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 2e7bfb1..d2a4dab 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -3255,6 +3255,10 @@ static uiBut *ui_def_but_rna(uiBlock *block, int type, int retval, const char *s
 		but->drawflag |= UI_BUT_ICON_LEFT;
 	}
 	
+	if ((type == MENU) && (but->dt == UI_EMBOSSP)) {
+		but->flag |= UI_ICON_SUBMENU;
+	}
+
 	if (!RNA_property_editable(&but->rnapoin, prop)) {
 		ui_def_but_rna__disable(but);
 	}
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index d19b162..8ce7503 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -1357,12 +1357,10 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
 /* draws text and icons for buttons */
 static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *but, rcti *rect)
 {
+	const bool show_menu_icon = ui_but_draw_menu_icon(but);
 	float alpha = (float)wcol->text[3] / 255.0f;
 	char password_str[UI_MAX_DRAW_STR];
 
-	if (but == NULL)
-		return;
-
 	ui_button_text_password_hide(password_str, but, false);
 
 	/* check for button text label */
@@ -1375,8 +1373,8 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
 	/* If there's an icon too (made with uiDefIconTextBut) then draw the icon
 	 * and offset the text label to accommodate it */
 
-	if (but->flag & UI_HAS_ICON) {
-		const bool show_menu_icon = ui_but_draw_menu_icon(but);
+	if (but->flag & UI_HAS_ICON || show_menu_icon) {
+		const BIFIconID icon = (but->flag & UI_HAS_ICON) ? but->icon + but->iconadd : ICON_NONE;
 		const float icon_size = ICON_SIZE_FROM_BUTRECT(rect);
 
 		/* menu item - add some more padding so menus don't feel cramped. it must
@@ -1384,7 +1382,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
 		if (ui_block_is_menu(but->block))
 			rect->xmin += 0.3f * U.widget_unit;
 
-		widget_draw_icon(but, but->icon + but->iconadd, alpha, rect, show_menu_icon);
+		widget_draw_icon(but, icon, alpha, rect, show_menu_icon);
 
 		rect->xmin += icon_size;
 		/* without this menu keybindings will overlap the arrow icon [#38083] */




More information about the Bf-blender-cvs mailing list