Cleanup: Reduce indentation in UI tooltip function
This commit is contained in:
@@ -372,35 +372,33 @@ static bool ui_tooltip_data_append_from_keymap(bContext *C, uiTooltipData *data,
|
||||
|
||||
LISTBASE_FOREACH (wmKeyMapItem *, kmi, &keymap->items) {
|
||||
wmOperatorType *ot = WM_operatortype_find(kmi->idname, true);
|
||||
if (ot != nullptr) {
|
||||
/* Tip. */
|
||||
{
|
||||
UI_tooltip_text_field_add(data,
|
||||
ot->description ? ot->description : ot->name,
|
||||
{},
|
||||
UI_TIP_STYLE_NORMAL,
|
||||
UI_TIP_LC_MAIN,
|
||||
true);
|
||||
}
|
||||
/* Shortcut. */
|
||||
{
|
||||
bool found = false;
|
||||
if (WM_keymap_item_to_string(kmi, false, buf, sizeof(buf))) {
|
||||
found = true;
|
||||
}
|
||||
UI_tooltip_text_field_add(data,
|
||||
fmt::format(TIP_("Shortcut: {}"), found ? buf : "None"),
|
||||
{},
|
||||
UI_TIP_STYLE_NORMAL,
|
||||
UI_TIP_LC_NORMAL);
|
||||
}
|
||||
if (!ot) {
|
||||
continue;
|
||||
}
|
||||
/* Tip. */
|
||||
UI_tooltip_text_field_add(data,
|
||||
ot->description ? ot->description : ot->name,
|
||||
{},
|
||||
UI_TIP_STYLE_NORMAL,
|
||||
UI_TIP_LC_MAIN,
|
||||
true);
|
||||
|
||||
/* Python. */
|
||||
if (U.flag & USER_TOOLTIPS_PYTHON) {
|
||||
std::string str = ui_tooltip_text_python_from_op(C, ot, kmi->ptr);
|
||||
UI_tooltip_text_field_add(
|
||||
data, fmt::format(TIP_("Python: {}"), str), {}, UI_TIP_STYLE_NORMAL, UI_TIP_LC_PYTHON);
|
||||
}
|
||||
/* Shortcut. */
|
||||
bool found = false;
|
||||
if (WM_keymap_item_to_string(kmi, false, buf, sizeof(buf))) {
|
||||
found = true;
|
||||
}
|
||||
UI_tooltip_text_field_add(data,
|
||||
fmt::format(TIP_("Shortcut: {}"), found ? buf : "None"),
|
||||
{},
|
||||
UI_TIP_STYLE_NORMAL,
|
||||
UI_TIP_LC_NORMAL);
|
||||
|
||||
/* Python. */
|
||||
if (U.flag & USER_TOOLTIPS_PYTHON) {
|
||||
std::string str = ui_tooltip_text_python_from_op(C, ot, kmi->ptr);
|
||||
UI_tooltip_text_field_add(
|
||||
data, fmt::format(TIP_("Python: {}"), str), {}, UI_TIP_STYLE_NORMAL, UI_TIP_LC_PYTHON);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user