From aa0b268acbf352bdf69644bb11ee3b893008cc40 Mon Sep 17 00:00:00 2001 From: Severin Date: Mon, 24 Nov 2014 17:24:07 +0100 Subject: Fix T42710: Use string length for ID user buttons --- source/blender/editors/interface/interface_templates.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c index 95cb36a4672..56ff705d43b 100644 --- a/source/blender/editors/interface/interface_templates.c +++ b/source/blender/editors/interface/interface_templates.c @@ -473,11 +473,12 @@ static void template_ID(bContext *C, uiLayout *layout, TemplateID *template, Str if (id->us > 1) { char numstr[32]; + short numstr_len; - BLI_snprintf(numstr, sizeof(numstr), "%d", id->us); + numstr_len = BLI_snprintf(numstr, sizeof(numstr), "%d", id->us); - but = uiDefBut(block, UI_BTYPE_BUT, 0, numstr, 0, 0, UI_UNIT_X + ((id->us < 10) ? 0 : 10), UI_UNIT_Y, - NULL, 0, 0, 0, 0, + but = uiDefBut(block, UI_BTYPE_BUT, 0, numstr, 0, 0, + numstr_len * 0.2f * UI_UNIT_X + UI_UNIT_X, UI_UNIT_Y, NULL, 0, 0, 0, 0, TIP_("Display number of users of this data (click to make a single-user copy)")); but->flag |= UI_BUT_UNDO; -- cgit v1.2.3