Commit: aa0b268acbf352bdf69644bb11ee3b893008cc40
Author: Severin
Date:   Mon Nov 24 17:24:07 2014 +0100
Branches: master
https://developer.blender.org/rBaa0b268acbf352bdf69644bb11ee3b893008cc40

Fix T42710: Use string length for ID user buttons

===================================================================

M       source/blender/editors/interface/interface_templates.c

===================================================================

diff --git a/source/blender/editors/interface/interface_templates.c 
b/source/blender/editors/interface/interface_templates.c
index 95cb36a..56ff705 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;

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to