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:
authorBrecht Van Lommel <brechtvanlommel@pandora.be>2013-05-11 03:41:41 +0400
committerBrecht Van Lommel <brechtvanlommel@pandora.be>2013-05-11 03:41:41 +0400
commit00014949c8a2e77e29d7ad690e20630dc4ebd1af (patch)
treef322549979e42589130039900317559416fe6600 /source/blender/editors/interface/interface_layout.c
parent4ae201e105410df8df27bbe68bf7abc6ac3e49a0 (diff)
Fix #35262: assiging shortcuts from e.g. delete or selection mode menus did not
work anymore. This was due to a bugfix to show missing shortcut keys for e.g. the mesh > vertices > separate menu. Both should work now.
Diffstat (limited to 'source/blender/editors/interface/interface_layout.c')
-rw-r--r--source/blender/editors/interface/interface_layout.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 2bde6aa607f..0813e4cba07 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -1681,10 +1681,11 @@ static void menu_item_enum_opname_menu(bContext *UNUSED(C), uiLayout *layout, vo
uiItemsEnumO(layout, lvl->opname, lvl->propname);
}
-void uiItemMenuEnumO(uiLayout *layout, const char *opname, const char *propname, const char *name, int icon)
+void uiItemMenuEnumO(uiLayout *layout, bContext *C, const char *opname, const char *propname, const char *name, int icon)
{
wmOperatorType *ot = WM_operatortype_find(opname, 0); /* print error next */
MenuItemLevel *lvl;
+ char namestr[UI_MAX_NAME_STR], keybuf[128];
UI_OPERATOR_ERROR_RET(ot, opname, return );
@@ -1694,8 +1695,11 @@ void uiItemMenuEnumO(uiLayout *layout, const char *opname, const char *propname,
return;
}
- if (!name)
- name = RNA_struct_ui_name(ot->srna);
+ if (name)
+ BLI_strncpy(namestr, name, sizeof(namestr));
+ else
+ BLI_strncpy(namestr, RNA_struct_ui_name(ot->srna), sizeof(namestr));
+
if (layout->root->type == UI_LAYOUT_MENU && !icon)
icon = ICON_BLANK1;
@@ -1704,7 +1708,16 @@ void uiItemMenuEnumO(uiLayout *layout, const char *opname, const char *propname,
BLI_strncpy(lvl->propname, propname, sizeof(lvl->propname));
lvl->opcontext = layout->root->opcontext;
- ui_item_menu(layout, name, icon, menu_item_enum_opname_menu, NULL, lvl, RNA_struct_ui_description(ot->srna));
+ /* add hotkey here, lower UI code can't detect it */
+ if(layout->root->block->flag & UI_BLOCK_LOOP) {
+ if (ot->prop && WM_key_event_operator_string(C, ot->idname,
+ layout->root->opcontext, NULL, false, keybuf, sizeof(keybuf))) {
+ strncat(namestr, "|", sizeof(namestr)-1);
+ strncat(namestr, keybuf, sizeof(namestr)-1);
+ }
+ }
+
+ ui_item_menu(layout, namestr, icon, menu_item_enum_opname_menu, NULL, lvl, RNA_struct_ui_description(ot->srna));
}
static void menu_item_enum_rna_menu(bContext *UNUSED(C), uiLayout *layout, void *arg)