Fix button text overlapping with shortcut text in popups
The purpose of the keymap strings is probably for un-embossed menu items like seen in most pulldowns. I can't see a reason for also adding that string for regularly drawn buttons within popups, we don't add it anywhere else in the UI either. So this commit makes sure shortcut strings are only added to buttons that are drawn like pulldown-menu items.
This commit is contained in:
parent
129c3ac7b3
commit
920bff5224
Notes:
blender-bot
2023-02-14 19:44:16 +01:00
Referenced by issue blender/blender-addons#49919, Invoke popup menu has issue with operators that have custom keymaps
|
@ -1165,6 +1165,8 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
|
|||
uiBut *but;
|
||||
char buf[128];
|
||||
|
||||
BLI_assert(block->flag & UI_BLOCK_LOOP);
|
||||
|
||||
/* only do it before bounding */
|
||||
if (block->rect.xmin != block->rect.xmax)
|
||||
return;
|
||||
|
@ -1179,6 +1181,9 @@ static void ui_menu_block_set_keymaps(const bContext *C, uiBlock *block)
|
|||
}
|
||||
else {
|
||||
for (but = block->buttons.first; but; but = but->next) {
|
||||
if (but->dt != UI_EMBOSS_PULLDOWN) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ui_but_event_operator_string(C, but, buf, sizeof(buf))) {
|
||||
ui_but_add_shortcut(but, buf, false);
|
||||
|
|
Loading…
Reference in New Issue