[Bf-blender-cvs] [76a5e2abe3f] blender2.8: UI: helpful text when favourites menu is empty
Campbell Barton
noreply at git.blender.org
Fri Nov 30 01:23:11 CET 2018
Commit: 76a5e2abe3f76eac03969a176d91830562e0b10a
Author: Campbell Barton
Date: Fri Nov 30 10:40:44 2018 +1100
Branches: blender2.8
https://developer.blender.org/rB76a5e2abe3f76eac03969a176d91830562e0b10a
UI: helpful text when favourites menu is empty
===================================================================
M source/blender/editors/screen/screen_user_menu.c
===================================================================
diff --git a/source/blender/editors/screen/screen_user_menu.c b/source/blender/editors/screen/screen_user_menu.c
index e945a5ae291..45f82618d2e 100644
--- a/source/blender/editors/screen/screen_user_menu.c
+++ b/source/blender/editors/screen/screen_user_menu.c
@@ -189,6 +189,7 @@ static void screen_user_menu_draw(const bContext *C, Menu *menu)
(sl->spacetype != SPACE_TOPBAR) ? BKE_blender_user_menu_find(&U.user_menus, SPACE_TOPBAR, context) : NULL,
(sl->spacetype == SPACE_VIEW3D) ? BKE_blender_user_menu_find(&U.user_menus, SPACE_BUTS, context) : NULL,
};
+ bool is_empty = true;
for (int um_index = 0; um_index < ARRAY_SIZE(um_array); um_index++) {
bUserMenu *um = um_array[um_index];
if (um == NULL) {
@@ -202,11 +203,13 @@ static void screen_user_menu_draw(const bContext *C, Menu *menu)
uiItemFullO(
menu->layout, umi_op->op_idname, ui_name,
ICON_NONE, prop, umi_op->opcontext, 0, NULL);
+ is_empty = false;
}
else if (umi->type == USER_MENU_TYPE_MENU) {
bUserMenuItem_Menu *umi_mt = (bUserMenuItem_Menu *)umi;
uiItemM(menu->layout, umi_mt->mt_idname, ui_name,
ICON_NONE);
+ is_empty = false;
}
else if (umi->type == USER_MENU_TYPE_PROP) {
bUserMenuItem_Prop *umi_pr = (bUserMenuItem_Prop *)umi;
@@ -240,6 +243,7 @@ static void screen_user_menu_draw(const bContext *C, Menu *menu)
menu->layout,
&prop_ptr, prop, umi_pr->prop_index,
0, 0, ui_name, ICON_NONE);
+ is_empty = false;
}
}
}
@@ -254,6 +258,11 @@ static void screen_user_menu_draw(const bContext *C, Menu *menu)
}
}
}
+
+ if (is_empty) {
+ uiItemL(menu->layout, IFACE_("No menu items found."), ICON_NONE);
+ uiItemL(menu->layout, IFACE_("Right click on buttons to add them to this menu."), ICON_NONE);
+ }
}
void ED_screen_user_menu_register(void)
More information about the Bf-blender-cvs
mailing list