UI: Display menu description in popup button tooltip

For the `wm.call_menu` operator, display the menu's description
rather than "Open a predefined menu." And never show that
fallback tooltip.

Pull Request: https://projects.blender.org/blender/blender/pulls/164011
This commit is contained in:
Hans Goudey 2026-09-16 19:32:03 +02:00 • committed by Hans Goudey
parent 86e21e9f8a
commit 0d06dbf124
2 changed files with 18 additions and 0 deletions

View file

@ -69,6 +69,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
class OBJECT_MT_modifier_add(ModifierAddMenu, Menu):
bl_label = "Add Modifier"
bl_options = {'SEARCH_ON_KEY_PRESS'}
bl_description = "Add a procedural operation/effect to the active object"
def draw(self, context):
layout = self.layout

View file

@ -2242,6 +2242,22 @@ static std::string wm_call_menu_get_name(wmOperatorType *ot, PointerRNA *ptr)
CTX_IFACE_(ot->translation_context, ot->name);
}
static std::string wm_call_menu_get_description(bContext * /*C*/,
wmOperatorType * /*ot*/,
PointerRNA *ptr)
{
char idname[BKE_ST_MAXNAME];
RNA_string_get(ptr, "name", idname);
MenuType *mt = WM_menutype_find(idname, true);
if (!mt) {
return "";
}
if (!mt->description) {
return "";
}
return CTX_IFACE_(mt->translation_context, mt->description);
}
static void WM_OT_call_menu(wmOperatorType *ot)
{
ot->name = "Call Menu";
@ -2251,6 +2267,7 @@ static void WM_OT_call_menu(wmOperatorType *ot)
ot->exec = wm_call_menu_exec;
ot->poll = WM_operator_winactive;
ot->get_name = wm_call_menu_get_name;
ot->get_description = wm_call_menu_get_description;
ot->flag = OPTYPE_INTERNAL;