UI: Change Display of Orphan Data User Count #118683
|
@ -1710,6 +1710,7 @@ int UI_search_items_find_index(uiSearchItems *items, const char *name);
|
|||
* Adds a hint to the button which draws right aligned, grayed out and never clipped.
|
||||
*/
|
||||
void UI_but_hint_drawstr_set(uiBut *but, const char *string);
|
||||
void UI_but_icon_indicator_set(uiBut *but, const const char *string);
|
||||
void UI_but_icon_indicator_number_set(uiBut *but, const int indicator_number);
|
||||
|
||||
void UI_but_node_link_set(uiBut *but, bNodeSocket *socket, const float draw_color[4]);
|
||||
|
|
|
@ -6365,6 +6365,11 @@ void UI_but_hint_drawstr_set(uiBut *but, const char *string)
|
|||
ui_but_add_shortcut(but, string, false);
|
||||
}
|
||||
|
||||
void UI_but_icon_indicator_set(uiBut *but, const char *string)
|
||||
{
|
||||
STRNCPY(but->icon_overlay_text.text, string);
|
||||
}
|
||||
|
||||
void UI_but_icon_indicator_number_set(uiBut *but, const int indicator_number)
|
||||
{
|
||||
UI_icon_text_overlay_init_from_count(&but->icon_overlay_text, indicator_number);
|
||||
|
|
|
@ -1773,36 +1773,19 @@ static void outliner_draw_userbuts(uiBlock *block,
|
|||
uiBut *bt;
|
||||
ID *id = tselem->id;
|
||||
const char *tip = nullptr;
|
||||
char buf[BLI_STR_FORMAT_INT32_GROUPED_SIZE] = "";
|
||||
int but_flag = UI_BUT_DRAG_LOCK;
|
||||
|
||||
if (ID_IS_LINKED(id)) {
|
||||
but_flag |= UI_BUT_DISABLED;
|
||||
}
|
||||
|
||||
BLI_str_format_int_grouped(buf, id->us);
|
||||
bt = uiDefBut(block,
|
||||
UI_BTYPE_BUT,
|
||||
1,
|
||||
buf,
|
||||
int(region->v2d.cur.xmax - OL_TOG_USER_BUTS_USERS),
|
||||
te->ys,
|
||||
UI_UNIT_X,
|
||||
UI_UNIT_Y,
|
||||
nullptr,
|
||||
0.0,
|
||||
0.0,
|
||||
0,
|
||||
0,
|
||||
TIP_("Number of users of this data-block"));
|
||||
UI_but_flag_enable(bt, but_flag);
|
||||
|
||||
if (id->flag & LIB_FAKEUSER) {
|
||||
tip = TIP_("Data-block will be retained using a fake user");
|
||||
tip = TIP_("Item is protected from removal.\nClick to mark for deletion");
|
||||
}
|
||||
else {
|
||||
tip = TIP_("Data-block has no users and will be deleted");
|
||||
tip = TIP_("Item has no users and will be removed.\nClick to protect from deletion");
|
||||
}
|
||||
|
||||
bt = uiDefIconButBitS(block,
|
||||
UI_BTYPE_ICON_TOGGLE,
|
||||
LIB_FAKEUSER,
|
||||
|
@ -1818,7 +1801,11 @@ static void outliner_draw_userbuts(uiBlock *block,
|
|||
0,
|
||||
0,
|
||||
tip);
|
||||
|
||||
UI_but_func_set(bt, restrictbutton_id_user_toggle, id, nullptr);
|
||||
char overlay[5];
|
||||
BLI_str_format_integer_unit(overlay, id->us);
|
||||
UI_but_icon_indicator_set(bt, overlay);
|
||||
UI_but_flag_enable(bt, but_flag);
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue