Fixed "cleaning" of some menu labels (those with all the ugly %t/|), wasn't working in all cases.
Also cleaned some old, no more used piece of code.
This commit is contained in:
@@ -3790,15 +3790,16 @@ void uiButGetStrInfo(bContext *C, uiBut *but, int nbr, ...)
|
||||
if (type == BUT_GET_LABEL) {
|
||||
if (but->str) {
|
||||
/* Menu labels can have some complex formating stuff marked by pipes or %t, we don't want those here! */
|
||||
const char *tc;
|
||||
|
||||
if (but->type == MENU)
|
||||
tc = strstr(but->str, "%t");
|
||||
else
|
||||
tc = strchr(but->str, '|');
|
||||
|
||||
if (tc)
|
||||
tmp = BLI_strdupn(but->str, tc - but->str);
|
||||
const char *tc1, *tc2;
|
||||
|
||||
tc1 = strstr(but->str, "%t");
|
||||
tc2 = strstr(but->str, "|"); /* XXX For some reason strchr seems to not work here? */
|
||||
|
||||
if (tc2 && (!tc1 || tc1 > tc2))
|
||||
tc1 = tc2;
|
||||
|
||||
if (tc1)
|
||||
tmp = BLI_strdupn(but->str, tc1 - but->str);
|
||||
else
|
||||
tmp = BLI_strdup(but->str);
|
||||
}
|
||||
|
||||
@@ -4513,17 +4513,8 @@ static int ui_but_menu(bContext *C, uiBut *but)
|
||||
|
||||
button_timers_tooltip_remove(C, but);
|
||||
|
||||
#if 0
|
||||
if (but->rnaprop)
|
||||
name = RNA_property_ui_name(but->rnaprop);
|
||||
else if (but->optype && but->optype->srna)
|
||||
name = RNA_struct_ui_name(but->optype->srna);
|
||||
else
|
||||
name = IFACE_("<needs_name>"); // XXX - should never happen.
|
||||
#else
|
||||
uiButGetStrInfo(C, but, 1, &label);
|
||||
name = label.strinfo;
|
||||
#endif
|
||||
|
||||
pup = uiPupMenuBegin(C, name, ICON_NONE);
|
||||
layout = uiPupMenuLayout(pup);
|
||||
|
||||
Reference in New Issue
Block a user