mirror of
https://github.com/blender/blender
synced 2026-09-29 04:37:17 +03:00
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:
parent
86e21e9f8a
commit
0d06dbf124
2 changed files with 18 additions and 0 deletions
|
|
@ -69,6 +69,7 @@ class DATA_PT_modifiers(ModifierButtonsPanel, Panel):
|
||||||
class OBJECT_MT_modifier_add(ModifierAddMenu, Menu):
|
class OBJECT_MT_modifier_add(ModifierAddMenu, Menu):
|
||||||
bl_label = "Add Modifier"
|
bl_label = "Add Modifier"
|
||||||
bl_options = {'SEARCH_ON_KEY_PRESS'}
|
bl_options = {'SEARCH_ON_KEY_PRESS'}
|
||||||
|
bl_description = "Add a procedural operation/effect to the active object"
|
||||||
|
|
||||||
def draw(self, context):
|
def draw(self, context):
|
||||||
layout = self.layout
|
layout = self.layout
|
||||||
|
|
|
||||||
|
|
@ -2242,6 +2242,22 @@ static std::string wm_call_menu_get_name(wmOperatorType *ot, PointerRNA *ptr)
|
||||||
CTX_IFACE_(ot->translation_context, ot->name);
|
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)
|
static void WM_OT_call_menu(wmOperatorType *ot)
|
||||||
{
|
{
|
||||||
ot->name = "Call Menu";
|
ot->name = "Call Menu";
|
||||||
|
|
@ -2251,6 +2267,7 @@ static void WM_OT_call_menu(wmOperatorType *ot)
|
||||||
ot->exec = wm_call_menu_exec;
|
ot->exec = wm_call_menu_exec;
|
||||||
ot->poll = WM_operator_winactive;
|
ot->poll = WM_operator_winactive;
|
||||||
ot->get_name = wm_call_menu_get_name;
|
ot->get_name = wm_call_menu_get_name;
|
||||||
|
ot->get_description = wm_call_menu_get_description;
|
||||||
|
|
||||||
ot->flag = OPTYPE_INTERNAL;
|
ot->flag = OPTYPE_INTERNAL;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue